Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use watch expressions in chrome dev tools to watch variables in an angular component (properties of 'this' object)?

I am trying to debug a property which is in an Angular 6 component. Naturally it is called in code trough this variable -> this.model. I am debugging it at the moment and would like to add it as a watch expression in Chrome dev tools so I can see how it changes trough the execution of the code. I tried just adding this.model as a watch expression, however it returns undefined, as this refers to the window object, which doesn't have a model property, so I am getting undefined on my watch expression.

What would be the proper way to watch this.model?

like image 451
Stromwerk Avatar asked Jan 11 '19 12:01

Stromwerk


2 Answers

since the code is transpiled to js while executing, the reference of this changes. You can watch the _this instead. It will give you the instance of the component/service that you want to debug.

like image 140
Sachin Gupta Avatar answered Nov 13 '22 11:11

Sachin Gupta


use Augury

It logs all controller variables.

like image 29
m arcs kumar Avatar answered Nov 13 '22 10:11

m arcs kumar