I'm implementing angular material tabs in my angular 6 application. If I use the material tabs without binding to routerLink then the sliding animation works and the content in router outlet works. However when I bind to routerLink the sliding animation doesn't work and the content just appears in a very clunky way.
<div class="my-3">
<nav mat-tab-nav-bar>
<a mat-tab-link
*ngFor="let tab of tabs"
[routerLink]="tab.path"
routerLinkActive #rla="routerLinkActive"
[active]="rla.isActive">
{{tab.label}}
</a>
</nav>
</div>
<router-outlet></router-outlet>
The paths are declared inside of the component template:
tabs: any[] = [
{
label: "Details",
path: "details"
},
{
label: "Users",
path: "users"
}
]
And the modules are loaded lazily.
Does anyone know why the animation breaks? I have done some digging around to find an answer. I am importing BrowserAnimationsModule from '@angular/platform-browser/animations' in app module and I am not declaring any NoopBrowserAnimations anywhere either.
Any help would be much appreciated.