你如何遍历的预输入对象的数组? [英] How do you iterate over an array of objects for typeahead?

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

问题描述

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

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