I have a component called app-list-container, the structure of which is as follows:
HTML
<ul [attr.styleName]="styleName" [style.flexGrow]="flexGrow">
<!-- ITEM <li> -->
<ng-content></ng-content>
</ul>
SCSS
@import 'placeholders/scrollbar';
ul {
&[styleName='CHAT_MESSAGE'],
&[styleName='CHAT_LAST_MESSAGE'] {
@extend %scrollbar-y;
}
}
With this I generate the items (<li>) inside this component ... Now I don't understand why it is not applying this css rule.
The rule is only applied when I insert it in his father (app-list-container), for me it does not make sense to also insert the style through the father.
Notice in the image below that the css is being applied to the html element, but if it is applied to the <ul> it doesn't work, but it works if it is applied to the parent (<app-list-containr>):
What to do? (Note: I like to do and know the CORRECT mode).

[attr.styleName]="styleName"shouldn't it be[attr.styleName]="CHAT_MESSAGE"? (Unless styleName is a variable that containsCHAT_MESSAGE). Also be sure in your scss file there is no space between&and[stylename=CHAT_MESSAGE]but it seems to be ok in the code you gave us. If everything is OK then please provide a repro because it is working fine on mystackblitz stackblitz.com/edit/…