AngularJS - ng-options 不工作
AngularJS - ng-options isn't working
我有以下 data.types
:
types: Object
4: "x"
5: "c"
9: "y"
我正在尝试这个:
<select ng-options="key as value for (key, value) in data.types">
但无法填充 select 输入。如何使用 ng-options
而不是 ng-repeat
。
<select ng-model="yourModel" ng-options="key as value for (key, value) in data.types">
应该可以
您在 select 标签中错过了 ng-model
。
<select ng-model="yourNgModel" ng-options="key as value for (key, value) in data.types">
</select>
我有以下 data.types
:
types: Object
4: "x"
5: "c"
9: "y"
我正在尝试这个:
<select ng-options="key as value for (key, value) in data.types">
但无法填充 select 输入。如何使用 ng-options
而不是 ng-repeat
。
<select ng-model="yourModel" ng-options="key as value for (key, value) in data.types">
应该可以
您在 select 标签中错过了 ng-model
。
<select ng-model="yourNgModel" ng-options="key as value for (key, value) in data.types">
</select>