ionic4 页面跳转传值和新页面取值
程序员文章站
2022-03-23 13:52:20
页面跳转 : 新页面取值: import { ......
页面跳转 :
<ion-row *ngfor="let item of aboutdata.stockdata"
[routerlink]="[ '/stock-details']" /* 跳转页面*/
[queryparams]="item" /* 传的参数*/>
新页面取值:
import { component, oninit } from '@angular/core';
import {activatedroute} from "@angular/router"; /* 引入控件*/
@component({
selector: 'app-stock-details',
templateurl: './stock-details.page.html',
styleurls: ['./stock-details.page.scss'],
})
export class stockdetailspage implements oninit {
sparams:any={};
constructor(public _activerouter: activatedroute) {
this._activerouter.queryparams.subscribe(params=> {
console.log(params);
this.sparams=params;
console.log(this.sparams.symbol);
})
}
ngoninit() {
}
}