jquery - 如何在 ionic 3 中更改时获取 url 参数?
问题描述
我正在我的应用页面上加载 URL。在那,如果点击提交后URL参数会发生变化 - 如何获取URL中参数的变化?
updateUrl() {
console.log('check');
let localaccesstoken = localStorage.getItem('token');
let Url = 'http://abcd.net/outfit/index.php?option=com_j2store&view=checkout&mobile=mobile&tmpl=component';
let checkoutPage = window.open(Url, '_self');
console.log(JSON.stringify(checkoutPage));
return this.sanitizer.bypassSecurityTrustResourceUrl(Url);
}
上面的函数会丢失 URL。
如果发生任何更改,请帮助我捕获 URL。
解决方案
在 Angular 中,我们可以订阅(Rx 事件)到路由器实例
class MyClass {
constructor(private router: Router) {
router.events.subscribe((val) => {
// see also
console.log(val instanceof NavigationEnd)
});
}
}
或者
this.router.events.subscribe(event: Event => {
// Handle route change
});
推荐阅读
- python - 如何遍历 Python 中包含字典列表的 json 对象?
- routes - 为什么在德国没有标记违反周日 HGV 禁令的行为
- excel - 在引用之前清除特定的切片器
- python - float 类型的对象没有长度
- sql-server - Microsoft 中发生错误。NET Framework 尝试加载程序集时
- python - 使用列表之一的数据对字典中的列表进行排序
- excel - VBA - 在 word 文档中搜索包含特定字符串的表格并返回表格编号
- c# - MS Project - 禁用资源
- reactjs - Marerial Table 选择菜单是否连接到每一行?
- excel - Power Query 新列被过滤掉(错误:未找到“新列”列)