mercredi 24 juin 2015

Data from UI updating with delay - ng-repeat

I have the following problem and I would need some opinions about the possible causes/solutions of it.

I have a table with its body containing an ng-repeat

<tr data-ng-repeat="product in shoppingCart"> ... </tr>

with a delete button on each line:

<td class="total"><i data-ng-click="removeProduct(product, $index)" class="icon-remove-circle"> </i></td>

and the function:

removeProduct: function (removedProduct, index) {
     var _this = this;
     _this.$scope.shoppingCart.splice(index, 1);

     // + DELETE API Request
 },

The problem is that even if I do not wait for the API request response and the data in the model is updating immediately (the length and content of the shoppingCart object), the changes appear in the UI with a significant delay and not instantly as it should be.




Aucun commentaire:

Enregistrer un commentaire