Html 如何根据条件添加样式
我正试图根据我的输入复选框将css添加到我的div中Html 如何根据条件添加样式,html,css,angular,Html,Css,Angular,我正试图根据我的输入复选框将css添加到我的div中 <div class="pvreveal" [style]="ShowHideSection ? 'overflow:scroll;height:483px':''" > <input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " /> </div 通过使用[ngClass]。我不太喜欢内联风格 //CSS //组成部分 e
<div class="pvreveal" [style]="ShowHideSection ? 'overflow:scroll;height:483px':''" >
<input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " />
</div
通过使用[ngClass]
。我不太喜欢内联风格
//CSS
//组成部分
export class MyComponent {
public ShowHideSection : boolean = true;
}
//HTML
<div class="pvreveal" [ngClass]="{'myClass' : ShowHideSection}" >
<input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " />
</div>
使用[ngClass]
。我不太喜欢内联风格
//CSS
//组成部分
export class MyComponent {
public ShowHideSection : boolean = true;
}
//HTML
<div class="pvreveal" [ngClass]="{'myClass' : ShowHideSection}" >
<input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " />
</div>
这是否回答了您的问题i、 e.Text
这是否回答了您的问题i、 e.Text