Is there a way for me to call a method on an object returned by a module during the start-up of my AngularJS application?
Here is my module:
angular.module('features', [])
.factory('features', ['cookies', 'lib', function(cookies, lib) {
return {
init: function() {
lib.customer(cookies.get('customer')).then(function (enabled) {
this.feature = enabled;
});
},
feature: false,
};
}]);
In my app.js file, if I had something similar to:
var app = angular
.module('app', [
'features'
]);
How could I then do something like: features.init()
So that later on, I can just use features.feature to get the boolean value of the key-value pair?