Par*_*h M 17 compiler-errors typescript angular
我收到错误
Property 'duni' has no initializer and is not definitely assigned in the constructor.ts(2564)
Run Code Online (Sandbox Code Playgroud)
在下面一行
@ViewChild('bhondu') duni: ElementRef<HTMLTableDataCellElement>;
Run Code Online (Sandbox Code Playgroud)
在我使用给定的?其他地方使用打破代码使其成为可选。如何在不更改配置文件中的任何属性的情况下解决此错误?this.duni.nativeElementObject is possibly 'undefined'.ts(2532)
Yan*_*p-H 42
使用非空断言运算符
@ViewChild('bhondu') duni!: ElementRef<HTMLTableDataCellElement>;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8856 次 |
| 最近记录: |