shortQuestion
shortQuestion

Reputation: 493

Angular 6-7 ViewEncapsulation.emulated prefix

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?

Best regards

Upvotes: 0

Views: 139

Answers (1)

ABOS
ABOS

Reputation: 3823

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.

Upvotes: 2

Related Questions