Skip to content

Instantly share code, notes, and snippets.

@AregSargsyan
Created June 7, 2020 12:16
Show Gist options
  • Save AregSargsyan/2775ad5fa9b2467925e552bdde4ac761 to your computer and use it in GitHub Desktop.
Save AregSargsyan/2775ad5fa9b2467925e552bdde4ac761 to your computer and use it in GitHub Desktop.
ngAfterViewInit with setTimeOut
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