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

dropdown not work with routerLinkActive in the same component cause multiple onInit are called #1885

Closed
jjlorenzo opened this issue Apr 8, 2017 · 8 comments

Comments

@jjlorenzo
Copy link

jjlorenzo commented Apr 8, 2017

sorry for not having time right now for more details, basically the routerLinkActive directive trigger a view update that calls again the dropdown onInit and this second run it isn't handled properly, I see duplicated dom and the events doesn't works, this only happens on router navigation

call 1

call 1

call 2

call 2

@jjlorenzo
Copy link
Author

duplicated dom elements
dom

If I set container="body" it works but I like the inline styles

@valorkin
Copy link
Member

valorkin commented Apr 8, 2017

Thanks for note, I was not expecting ngOnInit run twice, can you check one thing: is ng on destroy is called in between?

@jjlorenzo
Copy link
Author

not, I checked this trying to make some cleanup without luck because it isn't called twice, the component doesn't get destroyed, (forgive my lack off knoledge) is like gets inspected again for changes.
I can confirm that if in the router I disable(returning at method start) RouterLinkActive.update it works, look at the picture, my guess is that line 129 is the one that cause the twice call.

screen shot 2017-04-08 at am 6 18 54

@valorkin
Copy link
Member

valorkin commented Apr 8, 2017

It seems to me that it is router activate issue, but I will provide a hack anyway

@jjlorenzo
Copy link
Author

jjlorenzo commented Apr 8, 2017 via email

@valorkin
Copy link
Member

@jjlorenzo please create an issue in angular repo and link it here
in meanwhile I will do a hack to block this behavior

plunker with reproduced issue will be required

@razvanmitre
Copy link

Do you have a link to the issue on the angular repo?

@jjlorenzo
Copy link
Author

jjlorenzo commented Apr 27, 2017

maybe this angular/angular#15925 or angular/angular#6782

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

No branches or pull requests

4 participants