So I'm working with Angular version 1.5.7 and receiving an object from the server that looks something like this:
var app = angular.module('myApp', []);function ctrl($scope){
$scope.properties.Consultants = [
{
text:"consultant1",
Group: {Name:"CorporateResource", Disabled:"False"}
},
{
text:"consultant2",
Group: {Name:"CorporateResource", Disabled:"False"}
},
{
type:"consultant3",
Group: {Name:"Resource", Disabled:"False"}
},
{
type:"consultant4",
Group: {Name:"Resource", Disabled:"False"}
}
];
}
and I need to filter the select list options I'm creating based based on Group.Name to only get values that have Group.Name == "CorporateProject". I've tried many variations of the following but cannot seem to get it to filter properly:
<select ng-model="test" ng-options="c as c.text for c in properties.Consultants| filter:{Group.Name: 'CorporateResource'}"></select>
You had wrong filter, It should look like below
ng-options="c as c.text for c in properties.Consultants
| filter: {Group: {Name: 'CorporateResource'}}"