具有简单数组初始化的ng-options
我对Angular和ng-options。 我有一个简单的数组,我想用它初始化一个选择。但是,我希望该选项的值=标签。 script.js $scope.options = ['var1', 'var2', 'var3']; html <select ng-model="myselect" ng-options="o for o in options"></select> 我得到的是: <option value="0">var1</option> <option value="1">var2</option> <option value="2">var3</option> 我想要的是: <option value="var1">var1</option> <option value="var2">var2</option> <option value="var3">var3</option> 所以我尝试了: <select ng-model="myselect2" ng-init=0 ng-options="options[k] as v for (k,v) in options"></select> <select ng-model="myselect3" ng-init=0 ng-options="b as b for b in …