我想把typescript变量传递给style,我不知道是否可能,这里有代码:
<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>