Set the Select default value-angular
1.HTML Code
<body ng-app="MyModule">
<div ng-controller="Myctrl">
<select ng-model="MyLabel" ng-options="V.label for V in lists"></select>
</div>
</body>
2.JS Code
var mymodule = angular.module ("MyModule", []);
Mymodule.controller (' Myctrl ', [' $scope ',
function ($scope) {
$scope. Lists = [
{"Label": "Step 1", "Value": "111"},
{"Label": "Step 2", "Value": "233"}
];
$scope. MyLabel = $scope. lists[0];//default array The first value as option
}
]);
3. Implementation results: The default display "Step 1"
4. Extended--ng-options usage [1]
The Ng-optins property can use an array or object in an expression to automatically generate an option list of Select, similar to Ng-repeat.
General usage:
For arrays:
L V.value for V in array
L V.value as V.label for V in array//V.label value as V.value
For objects:
L Label for (key, value) in Object
L Select as label for (key, value) in Object
5. References: More usage reference links
[1].http://www.cnblogs.com/panda-zhang/p/5290694.html