我遇到了一个奇怪的错误。当我使用 ng-value 时,页面会为某些选项呈现“value=0”。控制台不显示错误。
这是代码:
<option ng-repeat="x in makes" ng-value="{{x.make_id}}">{{x.make}}</option>
结果如下:
<option ng-repeat="x in makes" ng-value="acura" class="ng-binding ng-scope">ACURA</option>
<!-- end ngRepeat: x in makes -->
<option ng-repeat="x in makes" ng-value="alfa-romeo" class="ng-binding ng-scope" value="0">ALFA ROMEO</option>
<!-- end ngRepeat: x in makes -->
<option ng-repeat="x in makes" ng-value="alpina" class="ng-binding ng-scope">ALPINA</option>
<!-- end ngRepeat: x in makes -->
<option ng-repeat="x in makes" ng-value="armstrong-siddeley" class="ng-binding ng-scope" value="0">ARMSTRONG SIDDELEY</option>