@@@@@@@@@@@@@@@@@@@@@@@@@·····························································································································································································································
我是一名新手,现在我被困在一个我不明白为什么我在导出类@ViewChild('namInput')上遇到此错误的地方,然后用红色加下划线我似乎无法解决此问题。我也做了更新,但还是一样。有人可以帮我吗?
代码示例:
从“ @ angular / core”导入{Component,OnInit,ElementRef,ViewChild};
导出类ShoppingEditComponent实现OnInit {
答案 0 :(得分:0)
@ViewChild装饰器已将Angular 8版本中的options参数设为必需。
这里是一个例子:
@ViewChild('nameInput', { static: false }) nameInputRef: ElementRef;
或者当然,您可以根据需要将其设置为True。