Monday, 26 November 2018

How to namespace the _nghost/_ngcontent props in Angular?

I'm currently doing some experiments with sharing Angular apps as Web Components and I've faced an issue with the styles of one app affecting the other one.

Given the fact that I use the emulated view encapsulation, Angular will add special _nghost-c# and _ngcontent-c# props to my elements and also update the styles to use them. Now, since I may have multiple angular apps in a single page, those selectors can affect the other apps.

I've seen a few examples on the web where those props have a namespace in it, like _nghost-XXX-#, but I couldn't find a way to customize it.

Example of the issue



from How to namespace the _nghost/_ngcontent props in Angular?

No comments:

Post a Comment