Can we generate filters dynamically in Angular? Below are some basic filters that extract specific properties from an array of objects.
module.filter("firstAndLastName", function() {
return function(input) {
return input.map(function(obj) {
return obj.first_name + " " + obj.last_name
});
}
})
module.filter("gradYear", function() {
return function(input) {
return input.map(function(obj) {
return obj.grad_year
});
}
})
If we need to retrieve the "email_address" from an array of objects and use it, is there a way to dynamically create it during runtime?
module.controller("someController", ["emailAddressFilter",
function(emailAddressFilter) {
// utilize emailAddressFilter here
}
])
An inquiry about Angular components
Is there a method to dynamically generate Angular components?