Balanced routing routes have a property for this purpose, that is, an allow property:
window.angular.module('app',[]) .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/', { templateUrl: 'afterDoingSomething.html', controller: 'appCtrl', resolve: {
This way, only after the returned promise is resolved, view loading.
It makes no sense to try to explain this when egghead explains it so well:
Remember that any call to $ http or $ resource will return these promises, so you donโt have to work with them directly (return $http(...) works just as well), or you can combine many calls of $ http into one promise)
source share