It’s not possible to set the global ChangeDetection.
However, it is possible to set it on the CLI, so that all components newly generated using ng generate component (or ng g c) will have it set to OnPush.
Run this command to set it:
ng config schematics.@schematics/angular.component.changeDetection OnPush
Alternatively (this is what this command does), add this block at the base level of your angular.json:
// angular.json
{
//...
"schematics": {
"@schematics/angular": {
"component": {
"changeDetection": "OnPush"
}
}
}
}