The view can't update the value of status
variable.
This is an extract of my code deleted the code not relevant:
component.ts
export class MyComponent implements OnInit {
private status: string;
ngOnInit() {
this.status = "abc"; // OK binding
window['onYouTubeIframeAPIReady'] = (e) => {
this.player = new window['YT'].Player('player', {
videoId: this.video.videoId,
events: {
'onStateChange': this.onPlayerStateChange.bind(this)
}
});
};
}
onPlayerStateChange(event) {
switch (event.data) {
case window['YT'].PlayerState.PLAYING:
this.status= "xyz"; //Not possible binding
break;
}
component.html
<span>{{status}}</span> // it shows only abc, the expected is xyz
Anybody has an idea how can I update the variable in the window
and it reflects on the view?