Skip to content Skip to sidebar Skip to footer

Ionic 2 On Function Does Not Refresh The NgModel Properly

I use wavesurfer.js and after it's finish playing i want to change the pause button back to play button, but until i open a toggle or do something nothing happen. this.wavesurfer.o

Solution 1:

after it's finish playing i want to change the pause button back to play button, but until i open a toggle or do something nothing happen

I believe you are using this.playing in your html..

Your wavesurfer.js is changing the value outside Angular's zone.

Try using ngZone API:

import {NgZone} from '@angular/core';

constructor(private ngZone:NgZone){}

//...
this.wavesurfer.on('finish', function () {
  this.ngZone.run(()=>{
     this.isPlaying = false;
  });
}.bind(this));

NgZone API


Post a Comment for "Ionic 2 On Function Does Not Refresh The NgModel Properly"