app.component.html
<h1 [attr.color]="color">内容</h1>
app.component.ts
color='red';
app.component.scss
[color='red']{
color: red;
}
实际效果
Angular给HTML节点绑定自定义属性和变量,用于设置一些动态的状态变化非常有用!
阅读 45
2022-12-22
app.component.html
<h1 [attr.color]="color">内容</h1>
app.component.ts
color='red';
app.component.scss
[color='red']{
color: red;
}
实际效果
相关推荐
精彩评论(0)