How to feel and absorb the encapsulation styles?

0 like 0 dislike
4 views
Please help me to write a case study to show the effect and benefit of encapsulating styles. My option here. The problem here is that it is not clear what action shall myargument encapsulation: ViewEncapsulation.None

There the root element is nested. In each of them I disabled encapsulation, but the result is to both apply the styles from the first. Where is the logic?

Is it possible to more clearly show the benefit of using ViewEncapsulation for the case of nested elements?
by | 4 views

1 Answer

0 like 0 dislike
Please help me to write a case study to show the effect and benefit of encapsulating styles. My option here.

"Help"? You yourself did it. But why do something all the same and broke.

it is unclear what action shall myargument encapsulation: ViewEncapsulation.None

This trip encapsulate the styles of the component.

There the root element is nested. In each of them I disabled encapsulation, but the result is to both apply the styles from the first. Where is the logic?

You seem to have forgotten about that you in styles of child component commented out the background - and therefore applied the style from the parent component. Get commenting - and both elements will be styled in accordance with the rule of the child component.

Better yet - stop in addition to disable the encapsulation, and then elements of different components will be styled in their own way, despite the fact that the class name is the same. Actually, this is, as you put it? - "the benefits of encapsulation" - you can in each of the components to define their own style rules, without worrying that they will overlap with the styles of other components.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,687 users