首页 文章

Angular2多个下拉列表受到相同更改的影响

提问于
浏览
0

我正在使用Angular2和javascript . 目前在TreeView组件中有一个模板,如下所示:

<li>
  <label style="color:red">{{block.toString()}}</label>
  <select aria-label="block menu" (change)="blockMenuSelected(block,$event)">
    <option value="COPY_BLOCK" select>copy</option>
    <option value="CUT_BLOCK">cut</option>
    <option value="DELETE_BLOCK">delete</option>
  </select>
</li>
<li *ngIf= "block.nextConnection && block.nextConnection.targetBlock()">
  <tree-view [block]="block.nextConnection.targetBlock()"></tree-view>
</li>

请注意,'s a recursive component. So there is a treeview component inside of a treeview component. The problem is that when I select something in the block menu dropdown, any other block menu dropdown on the page is also is affected by that selection event. I'已经尝试为每个 <select> 元素提供一个唯一的ID,但是没有't changed anything. I'我不确定这是一个Angular2错误还是我做错了什么 .

1 回答

相关问题