Unable to set global ChangeDetection.
However, it can be installed in the CLI, so that all components newly generated using the ng generate component (or ng gc ) will be set to OnPush .
Run this command to install it:
ng config schematics.@schematics /angular.component.changeDetection OnPush
Alternatively (this is what this command does), add this block at the basic level of your angular.json :
// angular.json { //... "schematics": { "@schematics/angular": { "component": { "changeDetection": "OnPush" } } } }
source share