I had a Angular Material Dialog.Code snippet for the invoker: In the template:
<ag-grid-angular
...
(cellClicked)='onGridCellClicked($event)'>
</ag-grid-angular>
In the component:
onGridCellClicked(event) {
if (event.colDef.field == 'name') {
this.showSurveyDetails(event.data);
}
}
showSurveyDetails(data) {
const dialogData = data;
this.dialog.open(SurveyDetailsDialogComponent, { width: '80vw', data: dialogData });
}
Here dialog is a MatDialog. Now to turn it into a regular component I am replacing the code this.dialog.open with
this.router.navigate(['getSurveySummary',{dialogData:dialogData}]);
where router is ActivatedRoute. Now the problem is it is not finding the route. The route is defined in app.routing.ts as:
{ path: SurveyRoutes.SURVEY_SUMMARY, component: SurveyDetailsDialogComponent, canActivate: [ValidateLogin] }
SURVEY_SUMMARY is defined in app.routing.constants.ts as:
SURVEY_SUMMARY = 'getSurveySummary'
The error message is:
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'getSurveySummary;dialogData=%5Bobject%20Object%5D'
Error: Cannot match any routes. URL Segment: 'getSurveySummary;dialogData=%5Bobject%20Object%5D' at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (vendor.js:132813)
It would have been another matter if it failed in dialog box, but it is failing in routing itself. How to define the route so that flow is successful?