I have imported the service into the page .ts and the variable is updating properly, but the class is always on, even if the value of the ‘playing’ property is false. What am I doing wrong?
If it don’t work, try to use method in your page class, that return this.nowPlayingService.playing
If it don’t work too, then create separate property in your page class playing and use it in html. Use ngOnChanges method in your page class, and check if property you need changed - change this.playing
Hey – thanks for the tips. It turns out that my main problem was that I was improperly converting a string (“false”) to a boolean, which was causing all my booleans to evaluate to true. However, these tips helped me get some ngClass and ngIf stuff updating properly on model changes initiated by an asynchronous service, so thanks for laying out a few options. Definitely helpful. I ended up using a simple method that retrieves the class name on view update. (Note that using the service directly worked but wasn’t updating properly.)