You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two api's, one for auth users and one for non auth users.
In the controller i have function that send http request to the right api based if the user is authenticated or not.
The problem is the controller instantiate and send the request before the verify auth is finish the check and always send the http call to non authenticated api.
How i solve this problem?
The text was updated successfully, but these errors were encountered:
In the case you're using ui-router, you can use resolves to provide the controller with data before it's instantiated.
If any of these dependencies are promises, they will be resolved and converted to a value before the controller is instantiated and the $stateChangeSuccess event is fired.
$stateProvider.state('myState',{resolve:{// Example using function with returned promise.// This is the typical use case of resolve.// You need to inject any services that you are// using, e.g. $http in this examplepromiseObj: function($http){// $http returns a promise for the url datareturn$http({method: 'GET',url: '/someUrl'});}}});
My situation is like this:
The problem is the controller instantiate and send the request before the verify auth is finish the check and always send the http call to non authenticated api.
How i solve this problem?
The text was updated successfully, but these errors were encountered: