1. 程式人生 > >ng4 路由多參數傳參以及接收

ng4 路由多參數傳參以及接收

ret vat route value rsh ted con ram class

import { Router } from ‘@angular/router‘;

 constructor( 
        private router:Router,
    ) { }

    goApplicationDetail(instanceId:number,ownerShip:boolean){
        return this.router.navigate([‘/console/details/appDetail‘,{"instanceId":instanceId,"ownerShip":ownerShip}]);
    }
import {ActivatedRoute } from ‘@angular/router‘;
 constructor(
                private route:ActivatedRoute
               ) {
        
this.appId = this.route.params["value"].instanceId; this.tempOwnerShip = this.route.params["value"].ownerShip; this.tempOwnerShip==="true"?this.ownerShip =true:this.ownerShip =false; console.log("appid="+this.appId); console.log("ownerShip="+this.ownerShip); }

ng4 路由多參數傳參以及接收