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

routerlinkactive="activeStyle" is not loading the tab using tab-nav-bar and md-tab-link #2633

Closed
vkishorekumar80 opened this issue Jan 13, 2017 · 3 comments
Assignees

Comments

@vkishorekumar80
Copy link

When navigating to a route (tab3) from browser, the default implementation of the navbar using and rountLinkActive is loading the content properly and selecting the specified navigation link.

But When I try to do the same flow using md-tab-nav-bar and md-tab-link, the content is loaded properly but the navigation link not getting selected.

ng2material-navbarlink.zip

@chouclee
Copy link
Contributor

Check how to use md-tab-nav-bar in the overview

And be sure to read this issue #1967.

@vkishorekumar80
Copy link
Author

vkishorekumar80 commented Jan 13, 2017

Hi @chouclee

Instead of looking into the overview document, directly went in to the tabs-demo.html page where I routerLinkActive #rla="routerLinkActive" was not mentioned in the sample. Apology from my side for note reading the overview.

After reading the issue #1967 got the workaround and now working as expected.

<a md-tab-link *ngFor="let tabLink of navItems; let i = index" [routerLink]="tabLink.link" routerLinkActive #rla="routerLinkActive" [active]="rlaSafe && rla.isActive"> {{tabLink.label}} </a>

private rlaSafe: boolean = false; constructor(private changeDetectorRef: ChangeDetectorRef) { } public ngAfterViewInit() { this.rlaSafe = true; this.changeDetectorRef.detectChanges(); }

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants