Created
November 27, 2015 09:40
-
-
Save ratul0/16bfd1e89ad7d810b071 to your computer and use it in GitHub Desktop.
Angular service creation (Provider with Config option)
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
| (function () { | |
| var app = angular.module('app', []); | |
| app.provider('books',function(){ | |
| this.$get = function(){ | |
| var appName = "BookLogger"; | |
| var version = '1.0'; | |
| if(varsionFlag){ | |
| appName += ' ' + version; | |
| } | |
| return { | |
| appName : appName | |
| }; | |
| }; | |
| var varsionFlag = false; | |
| this.setVersionInclude = function (value) { | |
| varsionFlag = value; | |
| }; | |
| }); | |
| app.config(function(booksProvider){ | |
| booksProvider.setVersionInclude(true); | |
| }); | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment