javascript - Call to a function within $get of Provider modules causes TypeError -


this provider.

app.provider('cloudinarydetails', function(cloudinaryprovider){  function setcloudinarydetails(cloudinarydetails){     cloudinaryprovider.configure({         cloud_name: cloudinarydetails.cloud_name,         api_key: cloudinarydetails.api_key     }); }  this.$get = function($http){     return {             initialize: function(){             return $http.get('path/to/api').then(function(response){                 setcloudinarydetails(response.data);             });         }     }; }; 

});

i calling initialize function in config module

app.config(function(cloudinarydetailsprovider){ cloudinarydetailsprovider.initialize();  }); 

console error:

[$injector:modulerr] failed instantiate module app due to: typeerror: cloudinarydetailsprovider.initialize not function


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -