This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Make $routeProvider redirectTo injectable #5150
Closed
Description
I would like to add dependency injection support for the redirectTo
function, but I can't see a way to implement this without breaking the existing API.
I frequently need services available when determining where to redirect, and as a workaround, I end up defining routes with empty templates purely for handling redirect logic, and calling $location.path()
from within a resolve function on that route. It seems messy and would be much nicer to just keep this logic contained inside redirectTo
.
Would this be welcome as a PR and if so, any suggestions on implementation so as to avoid breaking existing code that expects normal function parameters on this method?