I want filter servers
on the condition for those records with serverState
and the initialstate
in them are not equal.
{{servers | filter : serverState != initialState}}
You can create your own custom filter which has logic to filter the server which don't have initial state matching with initalState variable value.
Your Custom filter
myApp.filter('filterServer', function () {
return function (servers,initialState) {
var filteredArray=[];
for (var k = 0; k < servers.length; ++k) {
var server = servers[k];
if (server.state != initialState) filteredArray.push(server);
}
return filteredArray;
};
});
Your HTML
<tr ng-repeat="server in Servers | filterServer : initialState">
<td style="width:50%;fload:left">
<span ng-bind="server.server"></span>
</td>
<td style="width:40%;fload:left">
<span ng-show="server.state==1">State 1</span>
<span ng-show="server.state==2">State 2</span>
</td>
</tr>
For sample please check this link