Skip to content

Instantly share code, notes, and snippets.

@congjf
Last active December 30, 2015 08:19
Show Gist options
  • Save congjf/7801845 to your computer and use it in GitHub Desktop.
Save congjf/7801845 to your computer and use it in GitHub Desktop.
Angular Service Dependence
Angular Service Dependence
angular.module('myModule', [], function($provide) {
$provide.factory('notify', ['$window', function(win) {
var msgs = [];
return function(msg) {
msgs.push(msg);
if (msgs.length == 3) {
win.alert(msgs.join("\n"));
msgs = [];
}
};
}]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment