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

405
Views
How can I repeat content (aka *ngFor) without a wrapping element?

I have an Angular 4 component that uses what is effectively a 2d array. I have an array of sections which hold an array of links. I want to be able to output them all flatly:

<ul>
  <div *ngFor="let section of all_sections">
    <li *ngFor="let nav of section.links" [class.active]="nav.href === current_url">
    </li>
    <li class="divider"></li>
  </div>
</ul>

How can I force it to do the loops but without the extra wrapping div for the sections? It should just be li tags inside the ul.

Expected output:

<ul>
    <li class="active"></li>
    <li class="active"></li>
    <li class="active"></li>
    <li class="divider"></li>
    <li class="active"></li>
    <li class="active"></li>
    <li class="active"></li>
    <li class="divider"></li>
</ul>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

you can try using ng-container

<ng-container *ngFor="let section of all_sections;">
 ...
</ng-container>
about 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!