angular Typescript 非空断言问题: Property ‘xxxx’ has no initializer and is not definitely assigned in the constructor.
我的错误是: Property ‘paginator’ has no initializer and is not definitely assigned in the constructor.
html文件
tyscript文件
原因在于浏览器加载dom时,我们此时所有dom节点已经加载完成,所以typescript会报错。
解决办法:
添加非空断言"!"在变量之后即可解决。