I got that error because I declared a variable and later wanted to
changed it's value using ngAfterViewInit
export class SomeComponent {
header: string;
}
to fix that I switched from
ngAfterViewInit() {
// change variable value here...
}
to
ngAfterContentInit() {
// change variable value here...
}