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

146
Vistas
Angular use string as outlet name

I need to use string varible as outletname rr

this is my code:

  public redirect(): any {
    let rr = 'productModal';
    let rr2 = 'm/addProduct';
    return this.router.navigate(    
      ['link/link', {outlets: {rr: rr2}}]
    );
  }
  
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

 public redirect(): any {
    let rr = 'productModal';
    let rr2 = 'm/addProduct';
    return this.router.navigate(    
      ['link/link', {outlets: {[rr]: rr2}}]
    );
  }
over 4 years ago · Santiago Trujillo Denunciar

0

If you want to give router outlet a name and to render components inside that outlet by using the router-outlet name, then the below solution works.

Step 1: Name the router-outlet tag using name attribute, In your case

  <router-outlet #outlet="outlet" name="rr"></router-outlet>

Step 2: Add the below code to that redirect button.

  [routerLink]="[{ outlets: {rr: ['m/addProduct']}} ]"

Step 3: in app-routing.module.ts file give the out-let name, In your case

        {path: 'm/addProduct',
        component: "Add product component",
        outlet: 'rr'}

The above solution worked for me.

over 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