我正在使用ng2 canvas whiteboard组件在我的网站上绘制画布,除了我尝试使用以下工具获取该画布的引用外,一切都很正常:
@ViewChild('canvasWhiteboard') canvasWhiteboard: CanvasWhiteboardComponent;
正如官方文件所建议的那样,我得到了这个错误:
Failed to compile. e:/frontend/src/app/components/user/dashboard/dashboard.component.ts (15,2): Cannot find name 'ViewChild'.
有什么建议吗?非常感谢。
你忘了导入 ViewChild 使用前
ViewChild
import { ViewChild } from '@angular/core'