Angular 8静态查询的使用和从An​​gular 7的迁移

时间:2019-08-05 22:29:52

标签: angular7 angular8

我在使用{static:true}时看到组件使用崩溃

Comparator.comparingInt

组件代码如下

 Cannot read property 'nativeElement' of undefined: "TypeError: Cannot read property 'nativeElement' of undefined

基于此处的文档,我的期望是,当我说{static:true}时,我的ViewChild是可以安全地在ngAfterViewInit中访问和使用的,因为它在ngOnInit-https://angular.io/guide/static-query-migration

之前就可以使用了。

这种理解不正确吗?

任何指针都值得赞赏。

谢谢

0 个答案:

没有答案