html
<ion-card *ngFor="let product_list of product.product_data; let i = index;">
<ion-list>
<ion-item class="ion-item-head">
<span class="text-bold text-white" >
{{product_list.product_name}}
</span>
<ion-badge color="danger" item-end tappable (click)="removeItem(product_list,i)">
<ion-icon name="close"></ion-icon>
</ion-badge>
</ion-item>
</ion-list>
</ion-card>
<ion-item>{{product.total_item}}</ion-item>
ts
export interface ProductAll {
cart_quantity:any;
item_total_price:any;
product_price:any;
id:any;
cart_id:any;
i:any;
}
export class Cart {
constructor(){}
}
removeItem(product_list: ProductAll, index) {
product_list.splice(index,1);
}
ionViewDidLoad() {
this.productCart.loadProduct().subscribe(
(res) => {
this.product = res;
});
}
I was creating ProductAll
interface for increment and decrement. What i will do now. Thanks in advanced.