17

I have this strange error and didn't find anything similar to it .. I'm using ng2-canvas-whiteboard component for a drawing canvas on my website, everything's working perfectly except when i try to get reference to that canvas using :

@ViewChild('canvasWhiteboard') canvasWhiteboard: CanvasWhiteboardComponent;

as the official docs suggested, i'm getting this error :

Failed to compile.

e:/frontend/src/app/components/user/dashboard/dashboard.component.ts (15,2): Cannot find name 'ViewChild'.

Any suggestions ? Thank you

1 Answer 1

65

You forgot to import ViewChild before using it

import { ViewChild } from '@angular/core'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.