Only increment one item inside ngFor (Angular 2)


constructor(public navCtrl: NavController,
public navParams: NavParams,
public apiserviceprovider: ApiServiceProvider,
public platform: Platform) {
this.session_id = localStorage.getItem(‘session_id_val’);
this.category = navParams.get(‘category_id’);

.then(data => {
this.productdetails = data;


this.qty = 1;


// increment product qty
incrementQty(item, data) {
this.qty += 1;

// decrement product qty
decrementQty(item, data) {
if(this.qty-1 < 1 ){
this.qty = 1
this.qty -= 1;
public goBack() {


when am clicking increment all the products value is change at a time. what am missed out this code

Increment and decrements item quantity based on id

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

And do you have a question or did you only want to show us your code?


You have only one qty property that is shared by all items. You need to move that into each item itself.


am not getting can u explain clearly.