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

180
Vistas
How to prevent onChange event from firing if a value is assigned dynamically?
 <ng-container *ngFor="let item of collectionValues">   
 <ion-checkbox slot="end" (ionChange)="onCheckBoxChange(item, $event)" 
        [(ngModel)]="item.value">
        </ion-checkbox>
 </ng-container>

This is ok but the problem is that if a value is assigned to item.value from the code in .ts i.e. then the onCheckBoxChange() is called which I don't want to. I have tried using the (click) event but that is not what I want. how do I prevent it from going to onCheckBoxChange event if a value is assigned. It should only go to the event if checked from UI.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As mentioned in the Angular Documentation you can use ngModelChange for your scenario

Event emitter for producing the ngModelChange event after the view model updates.

<ng-container *ngFor="let item of collectionValues">   
 <ion-checkbox slot="end" (ngModelChange)="onCheckBoxChange(item, $event)" 
        [(ngModel)]="item.value">
        </ion-checkbox>
 </ng-container>
about 4 years ago · Juan Pablo Isaza 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