@Component({
//changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'my-app',
template: `
{{name}}
`,
})
export class App {
from: any;
name: string;
constructor() {
this.name = '1'
}
ngAfterViewInit() {
this.name = "2"
}
}
上述问题导致ExpressionChangedAfterItHasBeenCheckedError
错误。
我有几个问题
ngAfterViewInit
不在摘要周期内?