Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!