How can we Hide the ionic button when we entered text in ion textarea in html


#1

hide the ionic button when we entered in ion textarea in html…Like whatsapp chat…when we typed something in textarea automatically voice button will be disabled…


#2

You can try like this

senabled:boolean=false;

Change function

if(input !== ''){
//enable the button
isenabled=true; 
}else{
//disable the button
isenabled=false;
}

In Html:

<button ion-button [disabled]="!isenabled"></button>

For changing classes:

<button ion-button [ngClass]="{class:isenabled,class2:!isenabled}"></button>

Good Luck
Thanks


#3

Thank you… and by using *ngIf also we can implement…


#4

use ngIF
example:
<ion-col col-2 *ngIf=“editorMsg”>
<button ion-button clear icon-only item-right class=“larger” (click)=“sendText(editorMsg)” >


	      <ion-col  col-2 *ngIf="!editorMsg">
          <button ion-button clear icon-only item-right (click)="sendVoice()">
          <ion-icon android="android-mic" md="md-mic"></ion-icon>
		     	</button>
			  </ion-col>