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
Post a Comment