现在遇到一个问题,Select的值是通过远程获取的,以下是服务器返回的json
当我用ng-options绑定到select后,option的value是这样的格式:
怎么有number:1这种样子哦,如何去掉另外,提交表单后怎么获取选中的值呢?感谢各位
首先写法是这样的
<select ng-model="xxx" ng-options="item.name for item in fishBreed track by item.fish_breed_id"></select>
ng-model里取出的就是你选中的对象, 双向绑定会通过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>
首先写法是这样的
ng-model里取出的就是你选中的对象, 双向绑定会通过item.fish_breed_id绑定值
js:$scope.toString = function(){
html: <option value="{{toString(x.id)}}" ng-repeat="x in list" ng-bind="x.name"></option>