You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the feature you would like to request.
It would be nice if there was an option on nav[mat-tab-nav-bar] with a[mat-tab-link]s that allowed it to animate the same way as a regular <mat-tab-group> with <mat-tab> elements.
Currently, with something like the following, you get animations when switching between tabs:
<mat-tab-group><mat-tablabel="One"><h1>Some tab content</h1><p>...</p></mat-tab><mat-tablabel="Two"><h1>Some more tab content</h1><p>...</p></mat-tab></mat-tab-group>
However, if you switch to using a <router-outlet> to navigate between tabs, you lose the slide in/out animation and must either forego the animation altogether or implement your own equivalent animation, which may make the UI inconsistent with other areas of your app that use <mat-tab-group> unless you are able to reproduce the same effect 100% the same.
<navmat-tab-nav-bar><amat-tab-link*ngFor="let link of navLinks"
[routerLink]="link.path"
routerLinkActive#rla="routerLinkActive"
[active]="rla.isActive">
{{link.label}}
</a></nav><router-outlet></router-outlet>
What is the use-case or motivation for this proposal?
Say you have a user profile screen that is using <mat-tab-group> to separate out various areas of your user profile. At one point, you may find that it is better for maintainability if each tab was its own component so you do not need to have one giant component with every piece of data that may show up across any of the tabs.
This is also better if, for example, each tab fetches data from a different source and you'd like to delay that network call until navigating to the tab (although lazy-loading may handle that as well).
Also, in a lot of cases, it would be more ideal to be able to deep link into a given tab by using a <router-outlet>, which is why mat-tab-nav-bar seems like a good fit for something like this.
Is there anything else we should know?
A work around may be to build separate components, have those components be within each <mat-tab>, and then manually wire up the active tab state in the router via query string or route params. However, it looks like mat-tab-nav-bar was built specifically for this use-case, so it may be worth just baking the functionality into mat-tab-nav-bar.
The text was updated successfully, but these errors were encountered:
Thanks for providing the feature request. Right now we do not intend to implement an animation with the nav and router. It sounds like it would be best to just use the tab group for your use case
Please describe the feature you would like to request.
It would be nice if there was an option on
nav[mat-tab-nav-bar]
witha[mat-tab-link]
s that allowed it to animate the same way as a regular<mat-tab-group>
with<mat-tab>
elements.Currently, with something like the following, you get animations when switching between tabs:
However, if you switch to using a
<router-outlet>
to navigate between tabs, you lose the slide in/out animation and must either forego the animation altogether or implement your own equivalent animation, which may make the UI inconsistent with other areas of your app that use<mat-tab-group>
unless you are able to reproduce the same effect 100% the same.What is the use-case or motivation for this proposal?
Say you have a user profile screen that is using
<mat-tab-group>
to separate out various areas of your user profile. At one point, you may find that it is better for maintainability if each tab was its own component so you do not need to have one giant component with every piece of data that may show up across any of the tabs.This is also better if, for example, each tab fetches data from a different source and you'd like to delay that network call until navigating to the tab (although lazy-loading may handle that as well).
Also, in a lot of cases, it would be more ideal to be able to deep link into a given tab by using a
<router-outlet>
, which is whymat-tab-nav-bar
seems like a good fit for something like this.Is there anything else we should know?
A work around may be to build separate components, have those components be within each
<mat-tab>
, and then manually wire up the active tab state in the router via query string or route params. However, it looks likemat-tab-nav-bar
was built specifically for this use-case, so it may be worth just baking the functionality intomat-tab-nav-bar
.The text was updated successfully, but these errors were encountered: