Let's say I'm using 2 arrays
$scope.city = [];
$scope.state = [];
now you need to swap the two array,
I'm using (angular.copy). Here's the logic, first copy one variable into temp and put value of second variable into first. now put the value of temp value into first one.
try understand below ex.
$scope.do = function(){
var temp_var = angular.copy($scope.state)
$scope.state = angular.copy(city);
$scope.city = angular.copy(temp_var)
}
0 Comment(s)