.provider('apiURLFetcher', function(){
if(!localStorage.getItem('apiURL')){ // if there is no apiURL in localStorage, set a default value
}
this.getURL = function(){ // fetches apiURL from localStorage
return JSON.parse(localStorage.getItem('apiURL'));
};
this.$get = function(){
return JSON.parse(localStorage.getItem('apiURL'));
}
})
.config(function (apiURLFetcherProvider, ImgCacheProvider,$stateProvider, $urlRouterProvider, $httpProvider, LoopBackResourceProvider) {
LoopBackResourceProvider.setUrlBase(apiURLFetcherProvider.getURL());
.........