[英]Show map values in ng-select
I want to put map values(1,2,3) into select. 我想将map值(1,2,3)放入select中。
<select ng-model="group" ng-options="g.key for g in groups"></select>
$scope.groups
is map {'a':'1', 'b':'2', 'c':'3'}
I know that by this code : $scope.groups
是map {'a':'1', 'b':'2', 'c':'3'}
,通过此代码,我知道:
<select ng-model="group" ng-options="key for (key, g) in groups"></select>
I can put keys. 我可以放钥匙。 I've tried ng-options="value for(value,g) in groups"
but it failed. 我已经尝试过ng-options="value for(value,g) in groups"
但失败了。
Inside this syntax: 在此语法内:
ng-options="key for (key, value) in groups"
The (key, value)
bit describes the key/value pair. (key, value)
位描述键/值对。 So, value
in your case is the value. 因此, value
在你的情况是值。
So, to use the value you would simply do this: 因此,要使用该值,您只需执行以下操作:
ng-options="value for (key, value) in groups"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.