Html 将Typescript变量设置为样式2

Html 将Typescript变量设置为样式2,html,css,angular,Html,Css,Angular,我想将typescript变量传递给style,我不知道是否可能,有代码: <tr *ngFor="let app of data"> <div class="progress_bar" style="width: {{app.applicationProgress}}%;"></div> </tr> My app.applicationProgress已设置(选中)使用ngStyle指令 更新代码: <div class="p

我想将typescript变量传递给style,我不知道是否可能,有代码:

<tr *ngFor="let app of data">
    <div class="progress_bar" style="width: {{app.applicationProgress}}%;"></div>
</tr>


My app.applicationProgress已设置(选中)

使用
ngStyle
指令

更新代码:

<div class="progress_bar" [ngStyle]="{'width': app.applicationProgress + '%'}"></div>