Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Cannot read property ‘visitStatement’ of undefined in angular2

I am getting the following error in my angular2 application.

TypeError: Cannot read property ‘visitStatement’ of undefined

like image 816
Hemanshu Bhojak Avatar asked Jul 04 '16 01:07

Hemanshu Bhojak


People also ask

How do you fix undefined properties Cannot be read?

To solve the "Cannot read properties of undefined" error, make sure that the DOM element you are accessing exists. The error is often thrown when trying to access a property at a non-existent index after using the getElementsByClassName() method. Copied!

What does Cannot read property of undefined mean?

What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects.


1 Answers

You get this issue when you have an empty event handler,

(click)=""

Getting rid of the empty event handler will fix this issue.

Ref:

  • https://github.com/angular/angular/issues/3754
  • http://hemanshubhojak.com/2016/07/04/angular2-cannot-read-property-visitstatement-of-undefined.html
like image 189
Hemanshu Bhojak Avatar answered Jun 22 '23 10:06

Hemanshu Bhojak