我正在尝试使用ngStyle标记为div容器设置样式。最终目标是根据box的属性进行插值,但是当我从getStyle函数返回时,我甚至无法使用静态字符串设置样式。
我尝试过在ng风格的论证中我能想到的每一个组合。
<div class="bounding-box" *ngFor="let boxs of bList [ngStyle]="getStyle(boxs)" ></div>
getStyle = (box) => {
var boxStyle = "{'height.px': 30','width.px': '30','background-color': 'red','left.px': '30','top.px': '30',opacity: '0.20'}";
return boxStyle;
}