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

494
Vistas
How to hide element in angular if one of the two condition is true

How to hide element in angular if one of the condition is true.

I tried with *ngIf="productID == category.Lane || productID == category.Val". It doesn't work.

 <label>ProductID</label>
      <ng-select
        appearance="outline"
        
        formControlName="productId"
        [clearable]="false"
        [searchable]="false"
        [(ngModel)]="productID"
        placeholder="Select an option"
      >
        <ng-option *ngFor="let product of products | orderBy: 'name'" value="{{ product.id }}">{{ product.name }}</ng-option>
      </ng-select>
      
      <div class="row" *ngIf="productID == category.Lane || productID == category.Val">
      <div class="col">
      <label>Promotion</label>
     </div>

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

With this condition:

*ngIf="productID == category.Lane || productID == category.Val"

You are saying, if first or second condition is truthy then show the element. If you want to hide it, in that case you should use the opposite condition:

*ngIf="!(productID == category.Lane || productID == category.Val)"
over 4 years ago · Santiago Trujillo Denunciar

0

Otherwise, you can use the hidden attribute instead of using *ngIf the condition

<div class="row" [hidden]="productID == category.Lane || productID == category.Val">
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