簡體   English   中英

如何使用angular8使數據列表從一個數組移動到另一個數組

[英]How to make the list of data move from one array to other using angular8

我有 2 組數組,一GroupGroup ,另一Not in group List Not in group 我有 2 個按鈕, move to right and move to left ,因此單擊它們時,所選數據必須根據我們選擇的按鈕向右或向左移動。 這里還應該實現列表中數據的多選。 我使用過 jQuery,但它沒有處理綁定的數據數組,並且所選列表在類中也沒有active ,在 html 中,這里沒有發生多個列表選擇,一次一個正在工作

不使用 jquery 如何實現。

演示: 演示

HTML:

 <li class="list-group-item" *ngFor="let item of agentInView; let i=index" (click)="select(i)" [ngClass]="{'active': selectedIndex == i, 'list-group-item': true}">{{item.value}}</li>

:

   selectInView(index: number) {
      this.selectedinViewIndex = index;
  }

有一個帶有多個選擇並從一個列表移動到另一個列表的演示。

  • 移動后選擇變得清晰,
  • 排序總是按 id

https://stackblitz.com/edit/angular-lh5vzl?file=src%2Fapp%2Fapp.component.ts

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM