1
我的路線定義爲:如何從ActivatedRoute(Angular2)獲得出口PARAMS
path: 'geooperations',
component: GeoMetricsComponent,
children: [
{ path: ':idgeooperationmetrictype', component: DetailGeoMetricTypeComponent, outlet: 'geo' },
{ path: ':idgeooperationmetrictype/edit', component: DetailGeoMetricTypeComponent, outlet: 'geo' },
{ path: '/new', component: DetailGeoMetricTypeComponent, outlet: 'geo' }
]
例子: 網址:geooperations /(GEO:c56da64c-0ef5-4894-83ee-043818b44e14)
outlet : 'geo'
idgeooperationmetrictype: 'c56da64c-0ef5-4894-83ee-043818b44e14'
如何從ActivatedRoute獲得'idgeooperationmetrictype'?
第一個答案沒有工作。但是,我可以通過this.activatedRoute.url._value [0] .path獲取'idgeooperationmetrictype'。我不知道這是否可行,或者有另一種方法通過outlet params來完成它? –
'activatedRoute.snapshot.params'做了個招數。 –