38

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 start 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

BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
Andon Mitev
  • 1,354
  • 1
  • 11
  • 30

5 Answers5

48

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 ).

Eli
  • 1,670
  • 1
  • 20
  • 23
  • 1
    You can also save component instances in global variables and then use ng.getComponents(). Details are discussed here https://mobiarch.wordpress.com/2020/07/08/ng-probe-no-more/ – RajV Jul 08 '20 at 17:28
33

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.

MrMalith
  • 1,352
  • 14
  • 22
17

Yes, augury assumes angular dev mode is active if window.ng exists, but ivy doesn't export probe right now

angular ivy exports I have augury but after I disable the extension there is no error anymore.

Mrinal Jain
  • 773
  • 9
  • 21
7

You could also run without Ivy with this in your tsconfig.app.json

"angularCompilerOptions": { "enableIvy": false }
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
Mr T
  • 81
  • 1
  • 4
2

This is not exactly related to this question, but googling led me here. So, I am leaving the solution to my problem here in hopes that it will help others who face the same problem.

I was getting ng.probe not a function error when I created a angular project using dotnet sdk(version 5.0.300) and ran it locally. The project was using @angular/core v8.2.12, and @angular/cli v8.3.29.

I was able to solve the problem by update these packages using -

ng update @angular/core@8 @angular/cli@8

or

npm run ng update @angular/core@8 @angular/cli@8

th1rdey3
  • 4,176
  • 7
  • 30
  • 66