I manage to move one object from one object array to another object array, but when I try to do an ng-repeat on the other object array in another tab nothing happens. Do I have to manually get it to loop trough the object array or something?
This is the code for the tab where the user can move the object:
<ion-content>
<ion-list show-delete="data.showDelete">
<ion-item class="item item-thumbnail-left item-remove-animate" ng-repeat="item in storedItems" href="#">
<ion-delete-button class="ion-minus-circled" ng-click="storedItems.splice($index, 1)">
</ion-delete-button>
<img src="{{item.pic}}">
<b><h2>{{item.name}}</h2></b>
<b><h2>{{item.amount}}</h2></b>
<button id="addButton" class="button button-icon icon ion-ios-plus-outline verticAlign" ng-click="moveToItems(item)">
</button>
</ion-item>
</ion-list>
</ion-content>
This is the code for the tab that will loop through the array and show it in a list with ng-repeat:
<ion-content>
<ion-list show-delete="data.showDelete">
<ion-item class="item item-thumbnail-left item-remove-animate" ng-repeat="item in items" href="#">
<ion-delete-button class="ion-minus-circled" ng-click="items.splice($index, 1)">
</ion-delete-button>
<img src="{{item.pic}}">
<b><h2>{{item.name}}</h2></b>
<b><h2>{{item.amount}}</h2></b>
</ion-item>
</ion-list>
</ion-content>
And here is a outtake from the controller:
$scope.moveToItems = function(item){
$scope.items.push(item);
console.log($scope.items);
};
$scope.items = [
];
$scope.storedItems = [
];
When I do the console log I see that I successfully adds objects to the object array.