Me stupid.
After having spend quite some time trying to figure it out and then writing the question....
Inject $rootScope and $location
into the service and use it in
$rootScope.$on("$routeChangeStart", function() {...})
Pergunta
I'm doing a redirect in the angularjs config
and I can see the initial location there:
$routeProvider.otherwise({
redirectTo: function(dummy, path, search) {
return "/default-page";
}
});
The problem is how to pass this information anywhere else.
$rootScope
either (so I can't broadcast it).$rootScopeProvider
, but have to use its $get
.$routeChangeSuccess
but I can't see there the original location.$routeChangeStart
, but it's no better.What do I want it for: Unlock a feature by using a "magic" URL like
.../#/cheat/a/lot?answer=43
It's just a debugging hack, nothing security relevant.
I guess I should do it differently (a normal page calling $location
?), but now I'm curious...
Solução
Me stupid.
After having spend quite some time trying to figure it out and then writing the question....
Inject $rootScope and $location
into the service and use it in
$rootScope.$on("$routeChangeStart", function() {...})