我想将typescript变量传递给样式,我不知道是否可能,有代码:
<tr *ngFor="let app of data">
<div class="progress_bar" style="width: {{app.applicationProgress}}%;"></div>
</tr>
Run Code Online (Sandbox Code Playgroud)
我的app.applicationProgress已设置(已选中)
使用该ngStyle指令.文档
更新的代码:
<div class="progress_bar" [ngStyle]="{'width': app.applicationProgress + '%'}"></div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1055 次 |
| 最近记录: |