Use case:
Code: Select all
moveAllToTarget: boolean = false; <-- I default the boolean to false.
Code: Select all
onMoveToTargetHandler(event) {
if (!this.moveAllToTarget) { <-- this still gets called even if I hit "Select All" button on the PickList. This is probably because this gets called regardless of "Move To Target" or "Move All To Target" buttons. Hence, at this point, my boolean is still false.
this.form.addControl(event.items[0].slug, this._formBuilder.group({//some model that matches the control added}))
}
}
Code: Select all
onMoveAllToTargetHandler(event) {
this.moveAllToTarget = true;
let itemsProcessed = 0;
event.items.forEach(item => {
this.form.addControl(item.slug, this._formBuilder.group({//some model that matches the control added}));
itemsProcessed++;
});
if (itemsProcessed === event.items.length) {
this.moveAllToTarget = false;
}
}
These two methods get called like almost simultaneously which causes me to have duplicated `FormControls` in my form.
Note: This is the exact copy of my question on StackOverflow. If you ever stumble upon that, feel free to answer there as well. Thanks
Is there a way to get around this? I thought I'd ask here before submitting an issue to PrimeNG Github.
Noti