Skip to content

Instantly share code, notes, and snippets.

@ratul0
Created November 27, 2015 09:40
Show Gist options
  • Select an option

  • Save ratul0/16bfd1e89ad7d810b071 to your computer and use it in GitHub Desktop.

Select an option

Save ratul0/16bfd1e89ad7d810b071 to your computer and use it in GitHub Desktop.
Angular service creation (Provider with Config option)
(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