1. ng-init 属性:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="//apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<select ng-model="selectedName" ng-options="x for x in names" ng-init="selectedName=names[2]">
</select>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.names = ["Google", "W3Cschool", "Taobao"];
});
</script>
<p>该实例演示了 ng-options 指令的使用。</p>
</body>
</html>
2. ng-selected 属性:
<html>
<head></head>
<body>
<!--<input type="text" ng-model="good.factory" title="{{good.factory}}">-->
<select class="facChoice" ng-model="good.factory" ng-change="fachan($index,good.factory)" title="{{good.factory}}" style="width: 140px">
<option value="">--选择工厂--</option>
<option ng-repeat="fa in facli" value="{{fa.dataid}}" class="facOption" ng-selected="good.factory ==fa.dataid">{{fa.NAME}}</option> </select>
</body>
</html>