Add global configuration for the default change detection and styles encapsulation settings #55023
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
Milestone
Which @angular/* package(s) are relevant/related to the feature request?
compiler-cli
Description
At the moment as a developer when I want to use
ChangeDetectionStrategy.OnPush
in the whole project, I need to add it to every component. It generates one more line and additional import and it's not intuitive.Would be great to have an option to set it globally and reduce number of lines in
@Component
decorator.Proposed solution
As far as I understand, it needs to set during compilation process, so probably the most obvious place to put configuration is
angular.json
The main problem that I see at the moment is that it shouldn't affect third party libraries from node_modules.
Alternatives considered
Make the
ChangeDetectionStrategy.OnPush
as default, but it will harm onboarding and it sounds bad thatChangeDetectionStrategy.Default
is not the default option. So I wouldn't consider it :DThe text was updated successfully, but these errors were encountered: