I'm new to Angular, I saw some code from my textbook as below:
...
@ContentChildren(PaCellColor)
contentChildren: QueryList<PaCellColor>;
ngAfterContentInit() {
this.contentChildren.changes.subscribe(() => {
setTimeout(() => this.updateContentChildren(this.modelProperty), 0);
});
}
I don't understand why we needs to use setTimeout
function?