Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate router hook #8

Closed
lucianogreiner opened this issue Feb 11, 2016 · 3 comments
Closed

Activate router hook #8

lucianogreiner opened this issue Feb 11, 2016 · 3 comments

Comments

@lucianogreiner
Copy link

Hello.

Is there a way to declare a "activate" router hook inside a component? I am trying to resolve some data before controller invocation, but either $activate/activate/$routerOnActivate is never called. On the other hand $canActivate seems to work.

@brandonroberts
Copy link
Owner

If you're using a templateUrl in your component, there is an existing bug where the $routerOnActivate hook isn't called. There is a pending PR for it here: angular/angular#6978. Once that gets merged in and the build is updated then that hook will work correctly. It will work fine if you use a template in your component

@lucianogreiner
Copy link
Author

Yeah, makes sense. I do also wonder why the name $routerOnActivate instead of just $activate, since $canActivate works.

Thank you mate

@brandonroberts
Copy link
Owner

No problem. It was originally $onActivate, but was renamed to avoid possible collisions with other lifecycle hooks in Angular 2 outside of the router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants