Expression ___ has changed after it was checked

后端 未结 17 2089
太阳男子
太阳男子 2020-11-22 05:53

Why is the component in this simple plunk

@Component({
  selector: \'my-app\',
  template: `
I\'m {{message}}
`, }) export class App {
17条回答
  •  情话喂你
    2020-11-22 06:23

    For this I have tried above answers many does not work in latest version of Angular (6 or later)

    I am using Material control that required changes after first binding done.

        export class AbcClass implements OnInit, AfterContentChecked{
            constructor(private ref: ChangeDetectorRef) {}
            ngOnInit(){
                // your tasks
            }
            ngAfterContentChecked() {
                this.ref.detectChanges();
            }
        }
    

    Adding my answer so, this helps some solve specific issue.

提交回复
热议问题