I need to make one filter in angularjs app. In my database, I keep a string value to say if the data is ative or inative. I use 'S' to active and 'N' to inative. But I made a checkbox button in my page to filter the data returned of the database, to show inatives or not. But I need to convert the value returned of de checkbox button to 'S' or 'N'. How can I do it? I am trying using this code:
app.filter('cakeActive', function(){
return function(input){
if(input == true){
return 'S';
}
else {
return 'N';
}
};
});
And in my DOM, is this:
<input checked type="checkbox" ng-model="active">
<div class="col s12 m12 l12" ng-repeat="cake in cakes | {cake.active == cakeActive:active}">...</div>
This is not working. What the best form to fix this situation? Thanks!