Could someone please provide an example of how to inject $rootScope into $routeProvider's resolveRedirectTo? I've checked the official documentation (https://docs.angularjs.org/api/ngRoute/provider/$routeProvider), but I couldn't find a practical example. Any assistance would be greatly appreciated.
Here is the code I tried, but it doesn't seem to be working:
$routeProvider.when("/", {
resolveRedirectTo: function($rootScope, $http){
console.log("externalUrl : " + $rootScope.externalUrl);
window.location = $rootScope.externalUrl;
}
})