html - 如何添加插值以获得 LI 的宽度?
问题描述
我想将 {{getCount(userObj.assigned_to, 'Applicable')}} + px 的相同值带到具有背景颜色的类的 LI 宽度,但是一旦我将相同的值添加到 style.width 就会出错。
Template parse errors: Parser Error: Got interpolation ({{}}) where expression was expected at column 1
<li class="chart__bar" [style.width]="{{getCount(userObj.assigned_to, 'Applicable')}}">{{getCount(userObj.assigned_to, 'Applicable')}}</li>
请建议如何获得 li 宽度。
解决方案
<li class="chart__bar" [ngStyle]="{'width': (getCount(userObj.assigned_to, 'Applicable')*10)+ '%'}">{{getCount(userObj.assigned_to, 'Applicable')}}</li>
推荐阅读
- machine-learning - 如果我只有一个输出,那么随着时间的推移反向传播的误差项是什么?
- c - 在 PostgreSQL 中,如何根据 C 函数中的类型 Oid 识别类型是复合类型?
- laravel - 将 csrf 令牌从 Laravel 传递给 Vue
- qemu - 有没有办法在 kvm/qemu 中指定硬盘安装顺序?
- ios - 来自 Crashlytics 的 EXC_BAD_ACCESS KERN_INVALID_ADDRESS 错误崩溃
- c# - 常见的 Asp.Net Core 系统绘图错误
- ios - 为什么我不能在选择器视图列表中选择我的第一个数据?
- sql - 如何在更新查询中使用 SUBSTR
- android - 底部应用栏导航图标不是垂直居中
- python - 使用 python + sqlanydb 在 SAP IQ 上加载数据。'由于文件权限,文件操作失败