【发布时间】:2019-12-28 15:37:36
【问题描述】:
Angular @ViewChild 错误:预期有 2 个参数,但得到了 1.ts (2554)。
我是一个新的学习者,现在我被困在一个点,我不明白为什么我会在我的导出类@ViewChild('namInput') 中收到这个错误,然后这行代码用红色下划线,并且我似乎无法解决这个问题。我也做了更新,但还是一样。有人可以帮我吗?
代码示例:
从 '@angular/core' 导入 { Component, OnInit, ElementRef, ViewChild};
导出类 ShoppingEditComponent 实现 OnInit {
- @ViewChild('nameInput') nameInputRef: ElementRef;
- @ViewChild('amountInput') amountInputRef: ElementRef;
【问题讨论】: