Created
June 12, 2014 08:59
-
-
Save cpoDesign/e9267a424a623ba34e91 to your computer and use it in GitHub Desktop.
Implementing select dropdown with default select option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.controller('myController', function($scope){ | |
$scope.teams = [ | |
{id:1, name:'team 1'}, | |
{id:2, name:'team 2'}, | |
{id:3, name:'team 3'}]; | |
// if I want to preselect item I can do following | |
// $scope.myTeam = 1; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select ng-options="team.id as team.text for team in teams" name="teamOption" ng-model="myTeam" class="InputBox"> | |
<option style="display:none" value="">Select a team</option> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment