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
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.
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.
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.
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.
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 ).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With