小编Tho*_*son的帖子

尝试获取 style="margin-left:{{data}};" 上班

index.ts
bubbles: any [][] = [['80%','Meeting'],['20%','Meeting']]

index.html
<div *ngFor="let bubble of bubbles">
      <div class="bubble" style="margin-left:{{bubble[0]}};">
      </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我试图让 margin-left 样式使用数组 bubbles[0] 中的数据。

for 循环在该布局中给出了 ['80%','Meeting'],因此我尝试将该数组的 0 元素设置为 margin-left 样式,但这不起作用。还有其他方法可以完成这个过程吗?

html css margin ngfor angular

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

css ×1

html ×1

margin ×1

ngfor ×1