I have an AnuglarJS app using ui-router and i have a http request that tells information about the user such as login state, access, language, user group, what controllers he can access and so on. It also defines behavior for some controllers and my ui-router states rely on it.
$http.get("/user").then(function(response) {
UserService.userData = response.data.userData,
});
Now I would like to delay all of the ui-router state change AND delay Services to be loaded if possible. And only allow anything to happen in the angular app after the request returned. So I can either redirect the user to the login page or load the proper templates, or do whatever i want inside the application based on the information received.
I would like this to apply to multiple routes with possibly adding exceptions.
So the goal i would like to achieve is to delay the angular.js app being loaded, wait for the http request to finish then continue the application.
$http- if users will searchAngularJS wait for $http requestthey will check this question/answer an they will see its nothing they searched for.