The Challenge
In my Angular2 project, I am using Swiper carousel and building it with Webpack. However, Angular2 adds random attributes like _ngcontent-pmm-6
to all elements in a component.
Swiper generates pagination elements dynamically, outside of Angular's scope. These elements do not have the same attributes as the rest of the component.
Here lies the issue: When Angular processes the CSS for a component (added via styleUrls
), it includes these attributes in the selectors.
.swiper-pagination-bullet { ... }
then becomes
.swiper-pagination-bullet[_ngcontent-pmm-6] { ... }
Since the pagination is rendered outside of Angular, the new elements do not have these attributes, causing the style to not apply properly.
The Inquiry
How can I make Angular2 aware of elements created outside of its scope?
Resource
https://angular.io/docs/ts/latest/guide/component-styles.html#!#inspect-generated-css