简体   繁体   中英

How To show button when button is clicked on ionic3

In My Project

I have a Two Buttons

1. click here button

2. save button

First i need to display only click here button, when user click click here button then save button will need to display on ionic3

Remember a boolean in your ts file

isButtonClicked: boolean = false

Change this boolean to true when the "click here" button is clicked and in the save button use ngif

<button *ngIf="isButtonClicked"> Save me </button>

Now the button wil show when the boolean is true and hide when it is false

In .ts file declare variable showFlag

showFlag:boolean=false;

And also create a function for show save button

  showSaveButton(){
    this.showFlag=true;
  }

In .html

  <button ion-button (click)="showSaveButton()">click here</button>
  <button ion-button *ngIf="showFlag">save</button>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM