你如何迭代一组对象以进行提前输入? [英] How do you iterate over an array of objects for typeahead?

查看:35
本文介绍了你如何迭代一组对象以进行提前输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

还有谁能解释一下这是什么?typeahead="state for state | filter:$viewValue"

Also could someone explain what for is this? typeahead="state for state in states | filter:$viewValue"

for 子句让我失望,它似乎真的不清楚,因为 state for state 共享相同的名称.

The for clause is throwing me off and it seems really unclear because state for state shares the same name.

推荐答案

state for state 是理解表达式,是

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆