[英]How To show button when button is clicked on ionic3
In My Project 在我的项目中
I have a Two Buttons 我有两个按钮
1. click here
button 1.
click here
按钮
2. save
button 2.
save
按钮
First i need to display only click here
button, when user click click here
button then save
button will need to display on ionic3 首先我只需要显示“
click here
按钮,当用户单击“ click here
按钮时,“ save
按钮将需要显示在ionic3上
Remember a boolean in your ts file 在ts文件中记住一个布尔值
isButtonClicked: boolean = false
Change this boolean to true when the "click here" button is clicked and in the save button use ngif 当单击“单击此处”按钮时,将此布尔值更改为true,然后在“保存”按钮中使用ngif
<button *ngIf="isButtonClicked"> Save me </button>
Now the button wil show when the boolean is true and hide when it is false 现在,该按钮将在布尔值为true时显示,在布尔值为false时隐藏
In .ts file declare variable showFlag
在.ts文件中声明变量
showFlag
showFlag:boolean=false;
And also create a function for show save button 并为显示保存按钮创建一个功能
showSaveButton(){
this.showFlag=true;
}
In .html
在
.html
<button ion-button (click)="showSaveButton()">click here</button>
<button ion-button *ngIf="showFlag">save</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.