84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
现在遇到一个问题,Select的值是通过远程获取的,以下是服务器返回的json
当我用ng-options绑定到select后,option的value是这样的格式:
怎么有number:1这种样子哦,如何去掉另外,提交表单后怎么获取选中的值呢?感谢各位
The first way to write it is like this
<select ng-model="xxx" ng-options="item.name for item in fishBreed track by item.fish_breed_id"></select>
What is taken out from ng-model is the object you selected. Two-way binding will bind the value through item.fish_breed_id
js:$scope.toString = function(){
list.id.toString(); }
html: <option value="{{toString(x.id)}}" ng-repeat="x in list" ng-bind="x.name"></option>
The first way to write it is like this
What is taken out from ng-model is the object you selected. Two-way binding will bind the value through item.fish_breed_id
js:$scope.toString = function(){
html: <option value="{{toString(x.id)}}" ng-repeat="x in list" ng-bind="x.name"></option>