How to disable the effect of ViewEncapsulation.None? E.g. One of my component (firstComponent) defines a css class with some properties. There is secondComponent which uses the same css class. I want my "secondComponent" to use the different specific values for properties defined by first component stylesheet. How can I achieve this?
Note : I redefined the same class in "secondComponent" with different values, keeping the viewEncapsulation of secondComponent default. It didn't work for me.
FirstComponent:
@Component({
moduleId: module.id,
selector: "FirstComponent",
templateUrl: 'FirstComponent.component.html',
styleUrls: ['FirstComponent.component.css'],
encapsulation: ViewEncapsulation.None
})
FirstComponent.component.css
.ui-tree .ui-tree-container {
background-color: #252525;
color: white;
}
Second Component:
@Component({
moduleId: module.id,
selector: "SecondComponent",
templateUrl: 'SecondComponent.component.html',
styleUrls: ['SecondComponent.component.css'],
})
SecondComponent.Component.css
.ui-tree .ui-tree-container {
background-color: white;
color: black;
}
I am creating p-tree in both the component, which internally uses .ui-tree-container. I want my secondComponent's tree's background should be white, while for all other places tree's background should remain black.
Ctrl+K
to show it as code and not as text – Brookbrooke