Trigger Angular change detection from console

I usually do it as follows in dev mode

ng.probe(getAllAngularRootElements()[0]).injector.get(ng.coreTokens.ApplicationRef).tick()

enter image description here

Starting with Angular 9 with Ivy you can call:

ng.applyChanges(ng.getComponent($0))

Where $0 points to component's element

enter image description here


Solution 1:
1. Click on the element (on which you want to trigger change detection) in the dev-tools Elements-Tab
2. ng.probe($0).injector.get(ng.coreTokens.ApplicationRef).tick()

Solution 2: Trigger a specific components change detector
1. Click on the element (on which you want to trigger change detection) in the dev-tools Elements-Tab
2. ng.probe($0).componentInstance.cdRef.detectChanges()

Tags:

Angular