Angular中通过router传递参数和获得参数

传递参数

   import { Router } from '@angular/router';
   constructor(private _router: Router) { }
   beamGroup(patient: PatientDto) {
    this._router.navigate(['app', 'beam-definition'], {queryParams: {patientId:       patient.id}});
    }

获取参数

    import { ActivatedRoute } from '@angular/router';
    constructor( public activatedRouter: ActivatedRoute,) {}
    ngOnInit(): void {
    let patientId = this.activatedRouter.queryParams['_value']['patientId'];}

你可能感兴趣的:(Angular)