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

这篇文章主要介绍了Angular+Ionic使用queryParams实现跳转页传值的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

最近,在做电商项目,项目中需要实现:点击编辑按钮,跳转页面完成添加地址,修改地址功能。
使用到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实现跳转页传值的方法的详细内容,更多请关注易知道|edz.cc其它相关文章!

推荐阅读