I am currently using ng-repeat to display a list of staff members:
<div ng-repeat="user in staff | profAndDr">
There is also a custom filter called 'profAndDr' that only shows people with the titles "Dr." and "Prof.":
app.filter('profAndDr', function() {
return function(input) {
var out = [];
angular.forEach(input, function(title) {
if (title.title === 'PROF.'||title.title==='DR.') {
out.push(title)
}
})
return out;
}
However, I now need to add a checkbox that will allow me to show people with the title "Prof. Amaritos" when checked. This means that I will need to remove the filter from ng-repeat if the checkbox is checked.
You can find the code for this on Codepen.
Thank you!