ame*_*lon 6 angularjs angular-ui
我使用typehead指令自动完成状态列表.该列表包含一堆对象,如下所示
{
StateId: 0,
StateCode: "AK",
StateDesc: "ALASKA"
}
Run Code Online (Sandbox Code Playgroud)
打字头HTML如下
typeahead="state.StateCode for state in States | filter:$viewValue | limitTo:8"
Run Code Online (Sandbox Code Playgroud)
这很好用,但我想稍微改进一下.是否可以让自动完成下拉列表显示(并搜索),StateDesc但是一旦您单击下拉项目,文本框就会被填充StateCode?
谢谢!
ame*_*lon 10
HTML需要
typeahead="state.StateCode as state.StateDesc for state in States | filter:$viewValue | limitTo:8"
感谢Pushpak让我指向正确的方向.
小智 8
假设你正在使用angular-ui bootstrap typeahead,那么可以轻松获得如何实现这一点.
http://plnkr.co/edit/NpWC6qvrzx7swGRFlpUR?p=preview
| 归档时间: |
|
| 查看次数: |
7891 次 |
| 最近记录: |