Here is what seems to be bothering a lot of people (including me). 这彷佛困扰了不少人(包括我)。 this
When using the ng-options
directive in AngularJS to fill in the options for a <select>
tag, I cannot figure out how to set the value for an option. 在AngularJS中使用ng-options
指令填写<select>
标签的选项时,我没法弄清楚如何设置选项的值。 The documentation for this is really unclear - at least for a simpleton like me. 这方面的文档真的不清楚 - 至少对像我这样的傻瓜来讲。 spa
I can set the text for an option easily like so: 我能够像这样轻松设置选项的文本: .net
ng-options="select p.text for p in resultOptions"
When resultOptions
is for example: 例如,当resultOptions
: code
[ { "value": 1, "text": "1st" }, { "value": 2, "text": "2nd" } ]
It should be (and probably is) the most simple thing to set the option values, but so far I just don't get it. 它应该(而且多是)设置选项值最简单的事情,但到目前为止我尚未获得它。 文档