javascript - Is there any way to use $http inside the config function or there is any way call the url inside config to get the value in angular js -


i want call servlet inside config function of angular js accept language using $http inside config function possible or alternate solutions please.as new angular js

uhm reading ask, think can use function inside .config() , inside function inject services need.

i'll leave example using function ui.router can make idea of how use it.

app = angular.module('myapp', []) .config(function ($stateprovider) {     var dosomething = function ($http, $cookies, myservice) {         //here logic     }     $stateprovider         .state('mystate', {             url: '/',             resolve: { dosomething: dosomething },//for example here can use function              templateurl: "views/login.html",             controller: 'logincontroller'          });  }); 

otherwise can use providers inject on .config() , use it.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -