i'm trying to change the icon when click the button its show hidden content i need to change up and down arrow icon
<button clear text-center (click)="toggle()">
<ion-icon name="arrow-dropdown-circle"></ion-icon>
</button>
<ion-col [hidden]="!visible" class="accountBalance animated slideInUp">
<ion-list>
<ion-item>
<h3>limit</h3>
<ion-note item-right>
<h2>₹ 55000.00</h2>
</ion-note>
</ion-item>
<ion-list></ion-col>
file.ts
visible = false;
toggle() {
this.visible = !this.visible;
}
You could use *ngIf
directive here to show conditional icon.
<button clear text-center (click)="toggle()">
<ion-icon name="arrow-drop down-circle" *ngIf="!visible"></ion-icon>
<ion-icon name="arrow-drop up-circle" *ngIf="visible"></ion-icon>
</button>
You could use name
property instead of creating two different ion-icon
<button clear text-center (click)="toggle()">
<ion-icon
[name]="visible ? 'arrow-drop up-circle' :'arrow-drop down-circle'">
</ion-icon>
</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With