如何迭代一个对象数组以进行typeahead?

Str*_*rry 3 angularjs angular-ui-bootstrap

http://angular-ui.github.io/bootstrap/

我想使用bootstrap的typeahead,并在对象中搜索两个不同的键对.如何迭代数组对象?

也有人可以解释这是什么? typeahead="state for state in states | filter:$viewValue"

for条款让我失望,似乎真的不清楚因为state for state有相同的名字.

zs2*_*020 13

state for state in states 是理解表达,简称

angular.forEach(states, function (state) {
    return state;
});
Run Code Online (Sandbox Code Playgroud)

您可以查看有关在select指令的ngOptions中引入的理解表达式的文档.