Currently on Angular 7. A component input is a boolean value that may stay the same after falling into and out of an indeterminate state.
For example: I have expandable rows that can be opened individually or all at once.
this.expand will be false initially.
pass this.expand = true to open all rows
user collapses each row individually
pass this.expand = true and nothing happens. no change is detected.
the code will display how I handle this through a settimeout() but am looking for a cleaner solution.
expandAll() {
// if 'expanded' is already true we have to force push the update
if (this.expanded) {
this.expanded = false;
setTimeout(() => {
this.expanded = true;
}, 0);
} else {
this.expanded = true;
}
}
Hoping to force change detection without using this async code.