Skip to main content
added 1 character in body
Source Link
Doron Brikman
  • 2.6k
  • 1
  • 19
  • 17

you need to express that you should have parameters in this route:

export const routes: RouterConfig = [
    { path: "", component: MainPage },
    { path: "details/:id", component: DetailsPage }
];

then, you can pass it that way:

this._router.navigate(["details"["/details", selectedItem.id]);

in your DetailsPage you can get the parameters as an observable with the ActivatedRoute service.

you need to express that you should have parameters in this route:

export const routes: RouterConfig = [
    { path: "", component: MainPage },
    { path: "details/:id", component: DetailsPage }
];

then, you can pass it that way:

this._router.navigate(["details", selectedItem.id]);

in your DetailsPage you can get the parameters as an observable with the ActivatedRoute service.

you need to express that you should have parameters in this route:

export const routes: RouterConfig = [
    { path: "", component: MainPage },
    { path: "details/:id", component: DetailsPage }
];

then, you can pass it that way:

this._router.navigate(["/details", selectedItem.id]);

in your DetailsPage you can get the parameters as an observable with the ActivatedRoute service.

Source Link
Doron Brikman
  • 2.6k
  • 1
  • 19
  • 17

you need to express that you should have parameters in this route:

export const routes: RouterConfig = [
    { path: "", component: MainPage },
    { path: "details/:id", component: DetailsPage }
];

then, you can pass it that way:

this._router.navigate(["details", selectedItem.id]);

in your DetailsPage you can get the parameters as an observable with the ActivatedRoute service.