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

183
Vistas
What is the difference between the navigate function and routerLink in Angular 2?

I'm following the official Angular 2 tutorial and it uses the navigate function in a very similar way as the routerLink. What is the difference between them? Which to use when?

this.router.navigate(['/detail', this.selectedHero.id]);

[routerLink]="['/detail', hero.id]"
about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

[routerLink] is an Angular directive that you can use in html for <a> or <button> elements. The directive will listen for click events and navigate to the path created with params provided to routerLink.

this.router.navigate(['/detail', this.selectedHero.id]); is used in your component or service to navigate.

routerLink directive and this.router.navigate should navigate to exactly the same url if the same arguments are specified.

about 4 years ago · Santiago Trujillo Denunciar

0

routerLink is a directive that behind the scenes uses router.navigate() as well.

The value of routerLink and the function-argument in navigate is exactly the same.

about 4 years ago · Santiago Trujillo 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