export class YourPage {
// just an property to control whose button is shown
public allegaClicked: boolean = false;
}
然后在HTML中
<ion-content>
<!-- your content -->
...
<!-- use and ngIf to show your button, when clicked it'll set allegaClicked to the oposite value and show cameraButtons block -->
<button ion-button (click)="allegaClicked = !allegaClicked" *ngIf="!allegaClicked; else cameraButtons">Allega Verbale</button>
<!-- when ngIf is false it'll show that block, the else statement only works with ng-template, if you want another element instead of using an ng-template you can use *ngIf="allegaClicked", it's up to you -->
<ng-template #cameraButtons>
<div>
<button ion-button>Camera</button>
<button ion-button>Gallery</button>
</div>
</ng-template>
</ion-content>
1条答案
按热度按时间jexiocij1#
您可以使用
ngIf/else
来显示单击Allega verbale
时的按钮。在您的.ts
文件中,您将拥有:然后在HTML中
这样,您就可以简单地切换要显示的按钮。