在 Angular 应用程序中,我有一个带有<ng-content></ng-content>
. 我为将放入 ng-content 的内容添加了 scss 规则,但它们被忽略了。我试图解决 using :host
,但它不起作用。
https://stackblitz.com/edit/angular-ewqhzj
包装器组件:
<app-embed>
<p>Hello world!</p><h1 class="toBeColored">toBeColored</h1>
</app-embed>
嵌入组件中的样式:
:host {
border: 5px solid red;
padding: 15px;
display: block;
.toBeColored {
color: pink;
}
}
问题是未设置“toBeColored”字符串的粉红色