我有一些問題了解AngularUI Bootstrap的Typeahead指令。在它們的statesWithFlags對象數組的示例中,它們不一定解釋指令表達式在說什麼。Typeahead對象數組?
state as state.name for state in statesWithFlags | filter:{name:$viewValue}
鏈接:http://angular-ui.github.io/bootstrap/#/typeahead
他們利用國家的兩倍,可能有人給我講解一下?以及解釋過濾器究竟是什麼意思?
例如,當我嘗試用對象數組創建一個對象並使用Typeahead查看數據時,我似乎無法訪問任何數據。
JSON
$scope.dataExample = {
'students' : [
{
'id': 1,
'name': 'John Doe'
},
{
'id': 2,
'name': 'Jane Doe'
}
]
};
HTML
<input type="text" ng-model="selectedStudent" typeahead="student as students.name for student in dataExample | filter:{name:$viewValue}">
謝謝,這個竅門,並感謝您的信息! – 2015-01-28 14:34:14