when user click delete button in first list i need to delete the item and add same item in second list.
when user click Add button in second list i need to delete the item in second list and added to first one.
But issue is when i click "Berglunds snabbköp" the item added to second list but deleted first item.
HTML:
<b>First one</b>
<ul>
<li ng-repeat="x in records|orderBy:x">{{x}}
<input type="button" ng-click="del(x)" value="Delete">
</li>
</ul>
<hr>
<b>Second one</b>
<ul>
<li ng-repeat="x in details|orderBy:x">{{x}}
<input type="button" ng-click="add(x)" value="ADD">
</li>
</ul>
Script:
$scope.del=function(item){
alert(item);
$scope.details.push(item);
$scope.records.splice(item,1);
};
$scope.add=function(item){
alert(item);
$scope.records.push(item);
$scope.details.splice(item,1);
};
$scope.records
(but not the first one)