Last active
December 30, 2015 08:19
-
-
Save congjf/7801845 to your computer and use it in GitHub Desktop.
Angular Service Dependence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Angular Service Dependence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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