[英]Angular is not Reloading component when routerLink clicked
當我調用點擊事件時,我無法重新加載組件。 我嘗試了以下代碼
(dealCode,periodName) => {
let url:any='/valuation;dealcode=J9PPR;fundPeriod=2019Q3;useDefault=true';
this.router.navigateByUrl('/dummy', { skipLocationChange: true });
setTimeout(() =>this.router.navigate([url]));
}
Angular 正在做一個 url 編碼,你必須告訴他信任你
import { DomSanitizer } from '@angular/platform-browser';
constructor(
private _sanitzer: DomSanitizer
) { }
你的功能
(dealCode,periodName) => {
let url:any='/valuation;dealcode=J9PPR;fundPeriod=2019Q3;useDefault=true';
this.router.navigateByUrl('/dummy', { skipLocationChange: true });
const safeUrl = this._sanitzer.bypassSecurityTrustUrl(url);
setTimeout(() =>this.router.navigate([safeUrl]));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.