[英]How to pass data from one page to another page using angular fragments?
我正在嘗試在導航到另一個頁面時發送另一頁數據。
this.router.navigateByUrl('/homePage', { fragment:"hello world"});
我不確定如何在我的主頁內收到我的片段。 我在我的主頁上嘗試過他的內容。
ngOnInit() {
this.router.fragment.subscribe((fragment: any) => {
console.log("My hash fragment is here => ", fragment)
})
}
我沒有定義我不知道如何獲得片段任何幫助...
我可以通過更改以下內容在我的主頁中打印console.log
this.router.navigateByUrl('/homePage', { fragment:"hello world"});
對此
this.router.navigate(['parameter-to-device'], { fragment:"hello world"});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.