頁面跳轉 : <ion-row *ngFor="let item of aboutData.stockData" [routerLink]="[ '/stock-details']" /* 跳轉頁面*/ [queryParams]="item" /* 傳的參數*/> 新頁面取值: 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() { }
}