Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
how can apply routerLinkActive directive to this.router.navigate(...) method in angular?;

we can apply routerLinkActive directive along with [routerLink] simply as:

<a [routerLink]="'/profile'" routerLinkActive="active"> My Profile </a>

of course for tag <a></a>. but if we want to navigate for action as bellow: .ts file:

navigateToMyProfile(): void {
 this.router.navigate(['/profile']);
}
And the template is:

<mat-list-item (click)="navigateToMyProfile()">

where we can apply routerLinkActive directive for above method? Best regards

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Use mat-list-item as an attribute instead.

Use mat-nav-list tags for navigation lists (i.e. lists that have anchor tags).

Simple navigation lists can use the mat-list-item attribute on anchor tag elements directly

<mat-nav-list>
  <a mat-list-item routerLink="/profile" routerLinkActive="active">My Profile</a>
</mat-nav-list>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda