网络编程 
首页 > 网络编程 > 浏览文章

Angular+Ionic使用queryParams实现跳转页传值的方法

(编辑:jimmy 日期: 2024/5/8 浏览:3 次 )

最近,在做电商项目,项目中需要实现:点击编辑按钮,跳转页面完成添加地址,修改地址功能。
使用到angular传参,简单做一总结:

1,发送界面ts

//编辑地址
 EditorAddress(item) {
 console.log("选中的地址");
 console.log(item);
 this.router.navigate(['/editor-address'], { queryParams: item })
 }

2,接收界面ts

 public personName:string=""
 public phone:string=""
 public areaInfo:string=""
 public detailedAddress:string=""
 public isDefault:number
 
ngOnInit() {
 //编辑地址
 this.activatedRoute.queryParams.subscribe((res) => {
 this.personName =res.personName,
 this.phone=res.phone,
 this.areaInfo=res.areaInfo,
 this.detailedAddress=res.detailedAddress,
 this.isDefault=res.isDefault//1
 //
 })
 }

3,效果

Angular+Ionic使用queryParams实现跳转页传值的方法

上一篇:vue中使用vue-pdf的方法详解
下一篇:vue 将多个过滤器封装到一个文件中的代码详解
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网