Ionic 2 feature by feature does not update ngModel
I am using waveurfer.js and after it finishes playing I want to change the pause back button to play button but until I open the switch or do anything.
this.wavesurfer.on('finish', function () {
this.isPlaying = false;
}.bind(this));
I have this simple code, I used console.log (), so I know it was called correctly and the binding is good too. However, I only see the changes after I have done something on the page.
What should I do? Any help would be appreciated.
source to share
after finishing the game, I want to change the pause back button to play the button, but until I open the switch or do nothing
I believe you are using this.playing
in your html ..
Yours wavesurfer.js
changes the value outside of the Angular zone.
Try using the ngZone
API:
import {NgZone} from '@angular/core';
constructor(private ngZone:NgZone){}
//...
this.wavesurfer.on('finish', function () {
this.ngZone.run(()=>{
this.isPlaying = false;
});
}.bind(this));
source to share