0
我想填充States
在Select
與ng-options
。由於我是新角色,結果並不如預期。在SELECT中不能使用ng選項
控制器
$scope.statesList = function() {
StatesList.query(function (states) {
$scope.states = states;
});
};
的Html
<td data-ng-init="statesList()">
<select ng-model="practiceAdd.state" name="state{{$index+1}}" ng-class="{'has-error': editForm.{{$index+1}}.$invalid}"
ng-options="state in states" required>
</select>
</td>
陣列
$$hashKey: "05S"
_id: "53107e099d985dc404000015"
city: "mumbai"
country: "india"
state: "AR"
street: "1"
zipcode: 42101
請發帖'$ scope.states'數組來幫助我們解決它。 –
嗨查幾個網址: http://docs.angularjs.org/api/ng/directive/select http://stackoverflow.com/questions/12139152/how-to-set-value-property-in- angularjs-ng-options http://stackoverflow.com/questions/13047923/working-with-ng-options-in-angular –
@MaximShoustin我發佈了數組.. – Anup