var product_id = $this.attr('data-id');
angular.forEach($rootScope.cartItems, function(value, key) {
if (value.iProductID == product_id && key > -1){
$rootScope.cartItems.splice(key, 1);
console.log($rootScope.cartItems);
}
Here in above code, I'm removing object element from the array but after removing element using splice the console.log() displays the correct data results. But in my HTML $rootScope.cartItems still displays the removed element.
cartItemsare used in it? Are there someng-ifaround? Why do you need to use$rootScopebtw? Most of all due to scope's prototypal inheritance you can see some other array in your view but not the one you are changing in your$rootScope.