Custom toggle img, re-rendering problem


#1

The problem is huge delay in changing the icon when I test it on the device.

  • I tried to put it in tappable or inside button, its not the helping.

    <img [src]="favorite ?  'favorite.png' : 'not_favorite.png'"
               (click)="favorite()"/>
    

    favorite(){ this.favorite = !this.favorite }
    I think the problem is in reloading the content, its not reloaded immediately.
    So I was trying something like.
    favorite(){ this.ngZone.run(() =>{ this.favorite = !this.favorite; }

But its still is not rendered immediately.
What is the best practice for custom toggle image. ?