Using AngularJS 1.3.4.
I have a html table that is being populated from an web api where I make an http request to get that data and populate my html table. My example json is as below:
{
id: 1,
firstName: "John",
lastName: "Rein",
status: 'available'
},
{
id: 2,
firstName: "David",
lastName: "Gumry",
status: 'not available'
}
Now I have a dropdown below the table, and I am using ui-select for it. I want to populate this dropdown based on the status in my json. For example in my json above I have 2 status available and not available. I want my dropdown to have these values. After I populate my dropdown, I want to filter my table based on the dropdown value that is selected. I have my dropdown as:
<ui-select tagging ng-model="selected" theme="bootstrap">
<ui-select-match placeholder="Pick one...">{{$select.selected.value}}</ui-select-match>
<ui-select-choices repeat="val in values | filter: $select.search track by val.value">
<div ng-bind="val.value | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
I have created my jsfiddle at: https://jsfiddle.net/aman1981/wfL1374x/
I am not sure how can I bind the results from json to my DDL and filter my table.