Deeplink to modal

Hi guys
I use Deeplinks with “routeWithNavController” which works well to deeplink to a specific page. But is it possible to link to the home screen and just display a page as a modal? If yes, how can this be done?

Best
Janis

1 Like

In Angular I would create a route to a page and let that page open the modal as part of the OnInit hook. I am not sure if it is better to try to make the router do that for you.

Obviously, you can extend the route with an additional paramter to indicate you like to see the modal instead of the page itself

Thanks Tommertom! Do you know how can I route to the main page and pass additional parameters?

Check the example.

Somewhere you see the code below with the detail:\id part. The id is the parameter which is passed to the detail page. See the code in HeroDetailComponent on the implementation details.

const routes: Routes = [
  { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
  { path: 'dashboard', component: DashboardComponent },
  { path: 'detail/:id', component: HeroDetailComponent },
  { path: 'heroes', component: HeroesComponent }
];

For main path, I suspect (but never tested), you could try path: ':id' …etc, but personally I am not sure if I would do it this way.

I would probably do path:'mainmodal ;linking to the main component and then read the route in OnInit to catch the usage of mainmodal. At least, if the parameter you want to pass is static

Good luck

Tom