简体   繁体   English

AngularJS提前显示对象数组

[英]Angularjs typeahead display array of objects

Is it possible to have a typeahead with an array of objects? 是否可以提前输入对象数组? Example of the array 数组的例子

Edit: My current code only filters through the name object, and i want it to be able to filter through all the object such that, when i enter the postal code into the searchbox, it will display both the name and postal 编辑:我当前的代码只过滤名称对象,并且我希望它能够过滤所有对象,这样,当我在搜索框中输入邮政编码时,它将同时显示名称和邮政

 <input type="text" ng-model="selected" uib-typeahead="cname for cname in all | filter:$viewValue:onlyMatch| limitTo:5">

The example would be like this : Expected result 示例如下: 预期结果

You need it as 您需要它

  <input type="text" ng-model="selected" typeahead="state.NAME for state in POSTALCODES | filter:$viewValue | limitTo:8" class="form-control">

DEMO DEMO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM