現(xiàn)在遇到一個(gè)問(wèn)題,Select的值是通過(guò)遠(yuǎn)程獲取的,以下是服務(wù)器返回的json
當(dāng)我用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里取出的就是你選中的對(duì)象, 雙向綁定會(huì)通過(guò)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>
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)