我希望使用ng-options
在数组的选项中包含%符号。
以下是代码:
$scope.load_percentages = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50];
<select ng-model="loaddata.loadPercent" ng-options="loadpercentnumber as {loadpercentnumber + '%' +} for loadpercentnumber in load_percentages track by loadpercentnumber">
</select>
但是错误就像错误一样
答案 0 :(得分:0)
不要使用支架:
ng-options="loadpercentnumber as loadpercentnumber + '%' for loadpercentnumber in load_percentages track by loadpercentnumber"
答案 1 :(得分:0)
你几乎做对了。 使用:
<select ng-model="loaddata.loadPercent" name="loadPercent" ng-options="o as o+'%' for o in load_percentages">
</select>
答案 2 :(得分:-1)
尝试使用此代替实际的%
符号:%