Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

207
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda