Created
June 7, 2020 12:16
-
-
Save AregSargsyan/2775ad5fa9b2467925e552bdde4ac761 to your computer and use it in GitHub Desktop.
ngAfterViewInit with setTimeOut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-child', | |
template: `<span>{{count}}</span>`, | |
}) | |
export class ChildComponent { | |
count = 0; | |
constructor() { } | |
increaseCount() { | |
this.count = 1; | |
} | |
ngAfterViewInit() { | |
setTimeout(() => this.increaseCount()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment