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

616
Views
*ngFor y *ngIf juntos, Angular2, Ionic2

Estoy tratando de mostrar una lista de opciones usando ngFor pero solo cumpliendo ciertas condiciones, ¿es posible usar ngFor y ngIf juntos para lograrlo? Algo como esto:

 <ion-select [(ngModel)]="task"> <ion-option *ngFor="let task of tasks" [value]="task" *ngIf="task.ProjectId == project.Id">{{task.Title}}</ion-option> </ion-select>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

*ngFor y *ngIf no se pueden usar juntos en el mismo elemento.

Lo que puedes hacer es usar un contenedor ng.

<ng-container> es un contenedor lógico que se puede usar para agrupar nodos, pero no se representa en el árbol DOM como un nodo.

<ng-container> se representa como un comentario HTML.

 <ion-select [(ngModel)]="task"> <ng-container *ngFor="let task of tasks"> <ion-option [value]="task" *ngIf="task.ProjectId == project.Id">{{task.Title}}</ion-option> </ng-container> </ion-select>
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!