I would like for a Mat Dialog
to not appear if a specific condition has not been met. I had hoped to use Angular Guard, but there seems to not be an associated route with the component (aside of the overarching webpage it's called from).
[Consequently, I had hoped that it would fall under the canActivateChild
- but that stopped the whole page from loading. ]
I've rolled back my example to just trying to stop a particular component ('give-feedback') from being accessible based on the FeedBackGuard component (which now only returns false
).
The feedback component is called by a function on a page /example
. I have tried setting canActivate (for the component), canActivateChild (as a subset of example
page), setting canLoad, and multiple variations within.
Thus far, I have only succeeded in stopping example
from loading but not from the Mat Dialog being initiated for give-feedback
Currently, the configuration in app-routing.module.ts
is:
{path: 'Example', component: ExampleComponent,
canActivateChild : [FeedbackGuard],
children: [
{ path: 'feedback-example', component: MatDialog },
{ path: 'feedback-example', component: GiveFeedbackComponent }
]
},