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

614
Vistas
*ngFor and *ngIf together, Angular2, Ionic2

I am trying to display list of options using ngFor but only fulfilling certain condition, is it possible to use ngFor and ngIf together to achieve that? Something like this:

<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 Respuestas
Responde la pregunta

0

*ngFor and *ngIf cannot be used together on the same element.

What you can do is use an ng-container.

<ng-container> is a logical container that can be used to group nodes but is not rendered in the DOM tree as a node.

<ng-container> is rendered as an HTML comment.

<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 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