Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in console: ng.probe is not a function

Yesterday I updated Angular CLI and core to 8.0.0v. After that I successfully initialized a new app and ran it. Once the app was built and served on localhost:4200 I opened the console and there was an error:

ng.probe is not a function

I tried to research the issue, but there was no relevant info about it.

Actual result:

After ng serve / npm starts there is an issue in the console:

Uncaught TypeError: ng.probe is not a function. Current console state Current angular state

Expected result:

No error in the console

like image 991
Andon Mitev Avatar asked May 30 '19 06:05

Andon Mitev


People also ask

How do I fix console log is not a function?

To solve the "console.log is not a function" error, make sure to place a semicolon between your console.log call and an immediately invoked function expression and don't define any variables named console in your code. The second cause of the error is defining a variable named console in your code.

How do I debug my angular application from the console?

I always found it quite neat how to debug my Angular 1.x applications directly from my browser’s console. Take Chrome’s devtools for instance. You can open the Elements tab and click on your Angular component.

Why does angular throw an error when change detection fails?

In this case, Angular throws an error, since an Angular application can only have one change detection pass during which all change detection must complete So it’s important to switch modes when developing and deploying. To work with DOM, Angular uses platform dependent Renderers.

What does it mean when it says 'is not a function'?

Note that it's a bad practice to define a variable that shadows a native object, however sometimes 3rd party packages do this and you have no other way to access the native object, other than the window or global variables. In short, the "is not a function" error means that the value you're trying to invoke is not a function.


2 Answers

If someone is looking for an alternative to:

ng.probe($0) 

In Ivy, then please try this:

 ng.getComponent($0); 

Found it here, https://juristr.com/blog/2019/09/debugging-angular-ivy-console/

Thought I'd add this here for completion.

Note about ng.getComponent: you must focus the component tag ( e.g. <app-my-component> ) in the developer tools elements so that it will be in $0. It doesn't search up the hierarchy for parent components ( like ng.probe does ).

like image 66
Eli Avatar answered Sep 20 '22 20:09

Eli


If you're using Augury extension, disable or remove it. then, check the console. I've had the same issue and I removed the Augury.

Augury is having different set of debugging APIs, that's why that error occur.

like image 25
MrMalith Avatar answered Sep 23 '22 20:09

MrMalith