Angular Material 2 Tab Links unable to set default active tab -


after successful login on login page, route changes "inbound" view, has 2 tabs in navbar, "inbound" , "outbound". i'd "inbound" navtab selected reflect state of router. however, after implementing this demo, still isn't selected default

html:

        <nav md-tab-nav-bar *ngif="!router.url.includes('login')">             <a md-tab-link                 *ngfor="let tablink of tablinks; let = index"                [routerlink]="tablink.link"                routerlinkactive #rla="routerlinkactive"                [active]="rla.isactive">                 {{tablink.label}}             </a>         </nav> 

component:

import { component }            '@angular/core'; import { router }               '@angular/router'; import { mdtab, mdtablink }     '@angular/material';  @component({     selector: 'header',     templateurl: './header.component.html',     styleurls: [ './header.component.css' ] })  export class headercomponent {          tablinks = [         { label: 'inbound', link: 'inbound' },         { label: 'outbound', link: 'outbound' }     ];     constructor( private router: router ) { } } 

routes:

    const approutes: routes = [     {         path: '',         redirectto: '/inbound',         pathmatch: 'full'     },     {         path: 'inbound',         component: inboundmessagescomponent,         canactivate: [ routeguard ]     },     {         path: 'outbound',         component: outboundmessagescomponent,         canactivate: [ routeguard ]     },     {         path: 'login',         component: logincomponent     } ]; 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -