【发布时间】:2022-08-23 22:24:23
【问题描述】:
您好我在初始化 viewchild elementRef 时遇到问题 这对我来说总是很好,但是在 angular 13 中我收到一条错误消息
@ViewChild(\"text\", { static: true }) text : ElementRef;
属性 \'text\' 没有初始值设定项,并且在构造函数中未明确分配
谢谢
标签: angular
您好我在初始化 viewchild elementRef 时遇到问题 这对我来说总是很好,但是在 angular 13 中我收到一条错误消息
@ViewChild(\"text\", { static: true }) text : ElementRef;
属性 \'text\' 没有初始值设定项,并且在构造函数中未明确分配
谢谢
标签: angular
改成。
@ViewChild("text", { static: true }) text!: ElementRef;
阅读更多
【讨论】: