我想創建一個像 pre 一樣的按鈕,當我點擊 pre 按鈕(getPrevWeek)時會顯示 Next 按鈕,我如何在這個角度上創建。
注意:這里##hide/show 作業正常。我只需要展示
吹我的角度 html 代碼:
<button type="button" [disabled]="prevJoinDateValid" class="btn btn-info btn-spacing" (click)="getPrevWeek()" id="prev">Prev</button>
<button *ngIf="isShownnext" type="button" class="btn btn-info btn-spacing" (click)="getNextWeek()" id="next">Next</button>
角度 ts 檔案:
isShownnext: boolean = false ;
getPrevWeek() {
this.isShownnext = ! this.isShownnext;
}
uj5u.com熱心網友回復:
你只需要將this.isShownnext的值設定為true this.isShownnext = true
uj5u.com熱心網友回復:
對要隱藏的按鈕使用 NgIf 條件,并在其他按鈕單擊示例上使其為真:
<button (click)="ButtonClick()">pre</button>
<button *ngIf="mShowbutton">next</button>
ButtonClick()
{
this.mShowbutton=true;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/380675.html
