Is it possible to prefix or postfix the tags generated when
ViewEncapsulation.Emulated is enabled in an angular 2-7 component its now like
[_ngContent-C0] is there a setting to let it do something like
[_ngContent-C0-myApp] so adding a custom string to the generated class tag?
If you check angular source code related to dom rendering, https://github.com/angular/angular/blob/master/packages/platform-browser/src/dom/dom_renderer.ts#L32 , you will see that this attribute has fixed pattern and does not accept external settings. So my guess is, no, you cannot, at least for the current versions. and most likely, it will never expose such an option as it might result in non-unique identifiers which will break encapsulation.
update: componentId is the id defined in component definition, you can check https://github.com/angular/angular/blob/master/packages/compiler/src/aot/compiler.ts#L266, and you can see it is auto-incremented.
Answered By – ABOS
Answer Checked By – Jay B. (AngularFixing Admin)