Hi everyone.
I’m trying to use collection-repeat like this:
collection-repeat="order in orders"
The problem is when i try to update some data in one of the order and then add this changed order to orders and go back from order-detail page to main page with order list - something wrong with collection-repeat:
Looks like my order-list is frozen: I don’t see updated information in the order, and also scroll doesn’t work… The new updated information apply only after i click to select box to filtering the list, or i try to search on the page…
I save orders in the $rootScope.orders and i can see the changed data in this variable. Early when i used ng-repeat everything worked good! But now i need to use collection-repeat because list contains more than 900 elements.
Main view code below:
<ion-view view-title="Ordrer" class="orders">
<ion-content class="padding" delegate-handle="MainScroll" direction="y" on-scroll="getScrollPosition()">
<ion-list>
<a class="item item-avatar" collection-repeat="order in orders | filter:orderFilter | orderBy: sorting.Index"
item-width="100%"
href="#/orders/{{order.order_no}}/"
ng-style="{width: '100%'}"
item="item">
<img ng-src="img/{{order.shop_id}}-logo.jpg">
<h2>{{order.ship_to_name}} <span class="order-no">{{order.order_no}} # {{order.no}}</span></h2>
</a>
</ion-list>
</ion-content>
</ion-view>
Controller and service where i’m trying to update the order:
Controller:
$scope.saveData = function() {
.....
$scope.order.title = 'Hello world';
ordersManager.setOrder($scope.order);
}
Service:
setOrder: function(orderData) {
....
for (var i = 0; i < $rootScope.orders.length; i++) {
if($rootScope.orders[i].order_no === orderData.order_no) {
$rootScope.orders[i] = orderData;
console.log($rootScope.orders[i]);
break;
}
}
return order;
},
Ionic version is #1.0.0-rc.2
Can anyone help me with this problem?
Thanks!