我想将 typescript 变量传递给样式,我不知道是否可行,有代码:
<tr *ngFor="let app of data">
<div class="progress_bar" style="width: {{app.applicationProgress}}%;"></div>
</tr>
我的 app.applicationProgress 已设置(选中)
最佳答案
使用 ngStyle
指令。 Documentation
更新代码:
<div class="progress_bar" [ngStyle]="{'width': app.applicationProgress + '%'}"></div>
关于html - 用于设置 Angular 2 样式的 Typescript 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45630347/