I am having some issues understanding AngularUI Bootstrap's Typeahead directive. In their example of the statesWithFlags array of objects, they do not necessarily explain what the directive expression is saying.
state as state.name for state in statesWithFlags | filter:{name:$viewValue}
Link: http://angular-ui.github.io/bootstrap/#/typeahead
They use state twice, may someone explain this to me? As well as explain what exactly the filter is saying?
Example, when I try creating an object with an array of objects and go over that data with Typeahead, I cannot seem to access any of the data.
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}">