md-tab-nav-bar does not properly display active when child/relative routes are involved (removing the md- directives fix this)
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
Any active routerLinks with the md-tab-link directive should show the material design active styling
What is the current behavior?
Paths with children and or relative paths seem to break the md-tab-nav-bar active styling (the individual tabs do not show the active styling when the corresponding route is active).
What are the steps to reproduce?
I created a repo reproducing the problem at: https://github.com/danwulff/md-tab-nav-bar-error-with-children
Steps to reproduce:
- In a terminal $
git clone https://github.com/danwulff/md-tab-nav-bar-error-with-children && cd md-tab-nav-bar-error-with-children && npm install && ng serve
- browser to http://localhost:4200/
- click ‘sub route’
- click through the tabs to see that the first 3 don’t work
The markup of the tabs is found within sub.component.html
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular/cdk, @angular/material: 2.0.0-beta.8 Tested in Google Chrome 59
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Angular 6 Cheat Sheet (Part II) - Medium
A directive is a marker that is attached to a DOM element that lets the Angular HTML compiler ($compile) hook specific behaviors to...
Read more >Using Other route_design Options - 2021.2 English - Xilinx
The -unroute option removes routing for the entire design or for nets and pins, when combined with the nets or pin options. The...
Read more >Dispatcher Activities - Oracle Help Center
You can drill down to display the route information for any resource, bucket, or group selected in the upper panel. For example, if...
Read more >The new Angular Router – a simple example - Chariot Solutions
The directives for Angular Material Design help you style your application without a lot of css or container divs. We're going to use...
Read more >Route Directives - Embedthis
The Action directive may be used to ensure a specific program is used to run CGI scripts. The CGI handler may match URLs...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just took a look and there are two issues with your markup:
md-tab-nav requires that only one tab is considered active at a time. This means that duplicating tabs for
sub/
(or “one”) will behave unexpectedly. So the first step is to be sure to only use a single tab for any unique routeIn your master branch, you are redefining
#rla
for each tab. AFAIK the scope of this reference is template-wide, so really you’re just overwriting it 3 times. Opt for using a unique template reference name for each tab or use *ngFor like below,I hope this helps!
Without diving into your repo, did you look at using an exact route match?
https://angular.io/api/router/RouterLinkActive#routerLinkActiveOptions