This is my service provider.
App.provider('cloudinaryService', function(CloudinaryProvider){
function setCloudinaryDetails(cloudinaryInfo){
CloudinaryProvider.configure({
cloud_name: cloudinaryInfo.cloud_name,
api_key: cloudinaryInfo.api_key
});
}
this.$get = function($http){
return {
initialize: function(){
return $http.get('path/to/api').then(function(response){
setCloudinaryDetails(response.data);
});
}
};
};
});
The call to the initialize function is made in the application configuration module
App.config(function(cloudinaryServiceProvider){
cloudinaryServiceProvider.initialize();
});
Error Message:
[$injector:modulerr] The App module failed to instantiate due to: TypeError: cloudinaryServiceProvider.initialize is not a function