Changing ion-icon dynamically on click/select -

I am new to ionic native and basically trying to change the particular icon from the list of icons, in my case on click of toggle all the icons are changing. - Here is my code
Need more of Ionic solution for the problem i am facing.


<ion-card *ngFor=“let post of posts”>



<button ion-button clear small color=“danger” icon-start (click)=‘toggle(this)’>
<ion-icon [name]=“visible ? ‘heart’ : ‘heart-outline’”> - Here i am changing the icon

TS -

visible: boolean;
this.visible = !this.visible;

If you are saying you want to track visibility separately for each post, you must make it a property of the post, not of the page.

@rapropos Thank you for the reply,any working code pls share the fiddle or URL ?