September 2017
Intermediate to advanced
450 pages
11h 24m
English
Component styles work by isolating the generated selectors from their associated style files to a dynamic component ID that is appended to all its style selectors. For example, our app component's generated div selector will have an extra attribute, similar to [_ngcontent-c0], added to it:
div[_ngcontent-c0] { padding-top: 20px;}
These attribute component IDs are unique to each component in our application and prevent similar style selectors from cascading into each other:
div[_ngcontent-c1] { background-color: silver; border: 1px solid gray;}
This is a powerful feature for preventing our styles from causing unintended cascading in our user interface. However, sometimes, we do want cascading styles in our application for ...
Read now
Unlock full access