ng4 路由多参数传参以及接收

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.appId =
this.activatedRoute.snapshot.paramMap.get('instanceId');

        //this.tempOwnerShip = this.route.params["value"].ownerShip;
     this.tempOwnerShip =
this.activatedRoute.snapshot.paramMap.get('ownerShip');

this.tempOwnerShip==="true"?this.ownerShip =true:this.ownerShip =false; console.log("appid="+this.appId); console.log("ownerShip="+this.ownerShip); }

 

posted @ 2018-10-04 18:54  eedc  阅读(481)  评论(0编辑  收藏  举报