The interpolated values get applied to the span text content of all ngfor elements

故事扮演 提交于 2019-11-28 02:23:37

The problem is that you are binding to a property that is for the entire scope of the page.

<span>{{left}}</span>

Instead, I'd make existingDroppedItemZoneIn a type with properties:

existingDroppedItemZoneIn[]: DropBox[] = new {[
   {left:0, top:0},
   {left:20, top: 0}
]};

And then you would want to bind to each box's attributes:

<div class="box" *ngFor="let box of dropzone1">
   {{ box.dis }}
   <span>{{box.left}}</span>
   <span>{{box.top}}</span>
</div>

And this is a quick pseudo-code example. So it likely isn't perfect.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!