I've made my own module, with a provider. I want other users to be able to override the default config:
angular.module('mymodule').provider('mymoduleConfig', [function() {
var object = {
theme: 'default'
};
var updated = {};
this.setConfig = function(override) {
console.log('Config updated...', override);
updated = override;
}
return {
$get: function() {
return {
config: angular.extend(object, updated)
}
}
}
}]);
Within my own app, I include the mymodule
and try to use the setConfig
, however it doesn't trigger. When I call `
angular.module('example', ['mymodule'])
angular.module('example').config(['mymoduleConfigProvider', function(mymoduleConfigProvider) {
mymoduleConfigProvider.setConfig({
theme: 'bootstrap'
});
}]);
The setConfig
never gets called, but I cannot figure out why!