This particular question has been circulating without a satisfactory resolution for some time, so hopefully the information provided here will help clear up any confusion.
Essentially, I have an object called resolve attached to my routes, set up like this:
$routeProvider
.when('/',
{
templateUrl: "html/landing.html",
controller: "LandingController",
resolve: {
app: function ($q, $location) {
var defer = $q.defer();
var next = "landing";
checkRedirect(defer, $location, next);
return defer.promise;
}
}
});
The checkRedirect
function makes some AJAX
calls and can alter the $location
as follows:
$location.path("/home");
Everything appears to be functioning correctly, but there is a slight flicker of the old template before the redirect takes place and displays the correct template.