Bhrungarajni
Bhrungarajni

Reputation: 2535

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

i have 2 set of arrays, one in Group and the other List Not in group. I have 2 buttons, move to right and move to left, so on click of them, the selected data must move to right or to left based on button we select. Here multiple selection of data in list should also be implemented. I have used jQuery but it didnt worked with array of data binded, and the selected list also didnt get active in the class, in html, and here multiple list selection is not happening, one at a time is working

Without using jquery how can this be implemented.

DEMO: DEMO

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>

Ts:

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

Upvotes: 1

Views: 1415

Answers (1)

qiAlex
qiAlex

Reputation: 4346

There is a demo with multiple selections and moving from one list to another.

  • Selections are getting clear after moving,
  • Sort is always by id

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

Upvotes: 3

Related Questions