Send $http.get twice
Since you are saying that when you are logged the problem occurs...this is because of the fact that since you are using angular-ui-router the two events are very important.
$stataChangeStart(...) , and $stateChangeSuccesss(...)
Please be informed that the resolve which you are using
.state('global.home', { url: '/home', templateUrl: '/htmls/home.html', controller: 'MainCtrl', resolve: { postPromise: ['posts', function (posts) { return posts.getAll(); }] } })
is first resolved before the jump happens to the target url and then the view gets changed/updated.
One solutions is:
Please make sure that you have '&&' condition to be checked here as you are trying to login first and then get the data.
If you are using the angular ui router version 0.12 , please upgrade the version so that the issue resolves.Thanks.