I have two multi select lists.
On click/select of any item from 1st list, I want to remove the selected item from 1st list and to move the same to 2nd list and vice versa.
I have tried ng-change and ng-click but not getting idea.
Below is my code
1st List
<select style="min-height:200px"
multiple class="form-control"
ng-model="listOneItem"
ng-options="listOneItem.Name for listOneItem in listOneItems track by listOneItem.Name"
ng-change="moveItemsToSecondList();"></select>
2nd List
<select style="min-height:200px"
multiple class="form-control"
ng-model="listTwoItem"
ng-options="listTwoItem.Name for listTwoItem in listTwoItems track by listTwoItem.Name"
ng-change="moveItemsToFirstList();"></select>
Angularjs
$scope.moveItemsToSecondList= function () {
alert(listOneItem[0].Name);
};
$scope.listOneItems= [{
Name: 'Independence Day'
}, {
Name: 'Labor Day'
}, {
Name: 'Thanksgiving Day'
}, {
Name: 'Chrismas Day'
}];
I didn't write functionality to move yet because I am not able to call my methods. i.e. I just put an alert in the method as shown.