Add ability to configure default changeDetection and viewEncapsulation used by component generator #2822
Labels
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Overview of the Requested Feature
Would like to have a way to set the global behavior of the component generator to handle writing the following component metadata properties:
Something like the ability to set the default values to use for these from within the
angular-cli.json
file (or maybe some other generators config file) like so:with the following potential string values:
If these properties are not in the
angular-cli.json
file then the metadata properties would not be included in the component generator template (same behavior it currently does).Change Detection
If `"changeDetection" is set, the component metadata property would be included and set in the component generator template like so:
with "OnPush" using
ChangeDetectionStrategy.OnPush
and "Default" usingChangeDetectionStrategy.Default
.View Encapsulation
If `"viewEncapsulation" is set, the component metadata property would be included and set in the component generator template like so:
with "Native" using
ViewEncapsulation.Native
, "Emulated" usingViewEncapsulation.Emulated
and "None" usingViewEncapsulation.None
.Note
I think the ideal solution would be to have a way to create custom generator templates at a project level so users could control more than just the component metadata, but I am not sure if that is on the radar and if so, how far out it is.
The text was updated successfully, but these errors were encountered: