Yes. Pretty simply:
app.factory('notificationFactory', function () {
return {
success: function (text) {
toastr.success(text,"Success");
},
error: function (text) {
toastr.error(text, "Error");
}
};
});
Resolve factory in controller. Customize messages, notifications/etc in factory.
Despite the idea that code adds another abstraction, it's really effective.