【发布时间】:2019-11-20 22:52:46
【问题描述】:
我正在通过在我的 [ngStyle] 指令中减去变量 regOtValue 和 endTimeOverTimeOut 来使我的进度条的 width 样式属性动态化。但它总是抛出空白或插值错误(通过在[ngStyle]中添加{{ }})
这是我正在做的事情:
[ngStyle]="{'width': (getAttendance.regOtValue - getAttendance.attendance[getAttendance.findIndex].endTimeOverTimeOut) + '%', 'background-color': '#63B3EA'}"
请帮助我跟踪我的发展。
提前谢谢你!
【问题讨论】:
-
使用
style=" width: {{ (getAttendance.regOtValue - getAttendance.attendance[getAttendance.findIndex].endTimeOverTimeOut) + '%;' }} background-color : #63B3EA " -
这个方法会抛出一个警告:WARNING: sanitizing unsafe style value width: -5.763888888888889%;;背景颜色:#63B3EA
标签: javascript angular typescript dom