[英]primeng p-dialog change URL on close button - angular 2
按照Primeng關閉按鈕html,href指向#
<a *ngIf="closable" [ngClass]="{'ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all':true}" href="#" role="button" (click)="close($event)" (mousedown)="onCloseMouseDown($event)">
<span class="fa fa-fw fa-close"></span>
</a>
我的代碼是:
<p-dialog header="Student Confirmation" modal="true" appendTo="body" [resizable]="false">
如何將默認href從“#”更改為其他角度?
嘗試以下解決方案,但不適用於我:
public close(): void {
this.router.navigateByUrl("../studentAssignments", { relativeTo: this.route });
super.close();
}
我認為這是不可能的,因為這是primeng組件的默認HTML。
在這種情況下,您可以執行以下操作:可以在對話框組件上調用onHide
函數,然后重定向到您想要的任何位置
<p-dialog (onHide)="close()" header="Student Confirmation" modal="true" appendTo="body" [resizable]="false">
public close(): void {
this.router.navigateByUrl("../studentAssignments", { relativeTo: this.route });
}
從代碼中刪除href="#"
要么
添加href="javascript:void(0)"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.