Home > OS >  Show button in angular
Show button in angular

Time:12-15

I want to create one button like pre, when ever I will onclick of pre button (getPrevWeek) will show the Next button, how can I create on this angular.

Note: Here ##hide/show is working. i need only for show

Blow my angular html code:

<button type="button" [disabled]="prevJoinDateValid"  (click)="getPrevWeek()" id="prev">Prev</button>
<button *ngIf="isShownnext" type="button"  (click)="getNextWeek()" id="next">Next</button>

angular ts file:

isShownnext: boolean = false ;

getPrevWeek() {
   this.isShownnext = ! this.isShownnext;
}

CodePudding user response:

You only need to set the value of this.isShownnext to true this.isShownnext = true

CodePudding user response:

Use NgIf condition for the button you want to hide and make it true on other Button Click Example:

<button (click)="ButtonClick()">pre</button>
<button *ngIf="mShowbutton">next</button>

ButtonClick()
{
 this.mShowbutton=true;
}
  • Related