gpt4 book ai didi

javascript - Angular js ng-重复重复项

转载 作者:可可西里 更新时间:2023-11-01 09:39:31 25 4
gpt4 key购买 nike

我的 ng-repeat 没什么问题

  $http.get("/test-server/rest/servizi/listaRuoli")
.success(function(data){
$scope.servizio = data;
console.log(data.label);
})
 <div class ="input_form_right">
<strong>Seleziona un Servizio</strong> (obbligatorio)<br>
<select class="size_input_newbg">
<option ng-repeat="x in servizio" ng-bind = "x.label"></option>
</select>
</div>

问题是,由于我在网上阅读的 mongodb,我无法使用 $index 跟踪。一些想法?谢谢!

最佳答案

改用ng-options:

<select  class="size_input_newbg" ng-model="yourmodel" 
ng-options="r.id as r.label for r in servizio"
ng-bind = "r.label">
<option value="" disabled="">Select One</option>
</select>

关于javascript - Angular js ng-重复重复项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40464253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com