你如何遍历的预输入对象的数组? [英] How do you iterate over an array of objects for typeahead?
问题描述
http://angular-ui.github.io/bootstrap/
我想使用自举的预输入,并且在对象中搜索两个不同的密钥对。我如何遍历数组对象?
I want to use the bootstrap's typeahead, and search two different key-pairs in an object. How do I iterate over an array objects?
也可能有人解释什么是什么?预输入=状态,在状态状态|过滤器:$ viewValue
Also could someone explain what for is this?
typeahead="state for state in states | filter:$viewValue"
的为
子句扔我关闭,因为状态状态
共享相同的名字,似乎真的不清楚。
The for
clause is throwing me off and it seems really unclear because state for state
shares the same name.
推荐答案
状态在州
是COM prehension前pression,简称
state for state in states
is the comprehension expression, short for
angular.forEach(states, function (state) {
return state;
});
您可以看看在左右的 ngOptions 选择指令。
You can take a look at the documentation about the comprehension expression introduced at ngOptions of select directive.
这篇关于你如何遍历的预输入对象的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!