Skip to content Skip to sidebar Skip to footer

Ionic 2 Not Updating The Counter Property In Html

I have this simple example which does update the Counter value in my HomePage class. But in the html view:

{{Counter}}

this remains zero. The method: ondrag(

Solution 1:

This topic was already discussed in another SO thread: https://stackoverflow.com/a/35106069/2256927

This might resolve your problem!

Solution 2:

Your ondrag handler is attempting to use item which is actually a string - literally the iterated value of the items array. This means your code is throwing an exception on item.getSlidingPercent which doesn't exist. Try using event instead of item, like this:

  ondrag(event, item) {
    let percent = event.getSlidingPercent();
    if (percent === 1) {   
        event.close();
        this.Counter--;
    }
    if (percent + 1 === 0) {
        event.close();
        this.Counter++;
    }
  }

Post a Comment for "Ionic 2 Not Updating The Counter Property In Html"