I'm trying to build a simple notification service on angularJS :
angular.module("my.services", [])
.service("NotificationsService", function() {
this.show = function(message, options) {
// display a notification
};
this.error = function(message) {
this.show({...});
}
...
});
That would be fired when the server returns a "notifications" array embedded in the api :
{
notifications: [{type: "error", message: "Error message"}, ...],
data: [item1, item2, ...]
}
And now I would like to plug my service to $http, but I can't find a way to do so !...
Any ideas ?