Please Follow these steps to create an app where you can pass the URL parameters from one page into another page using the router features in Angular IONIC.

First, Start with a new blank project. For example:

ionic start blankApp blank --type=angular --capacitor

Once you have a blank project, generate a menu page

ionic generate page menu

OK, now all you have do to is add the following HTML code to each of the following pages:



Import the following:

import { PreloadAllModulesRouterModuleRoutes } from '@angular/router';


    path: 'menu/:xyz',
    loadChildren: () => import('./menu/menu.module').thenm => m.MenuPageModule)

Import the following:

import { Router } from '@angular/router';
import { Location } from '@angular/common';


add them to your constructor and create a btnClicked() function, so now your HomePage class will look like this:

export class HomePage {
    private router:Router,
    private location:Location
  ) {}
    console.log('btn clicked')

Add a click me button

<ion-header [translucent]="true">
      Send data between pages
<ion-content [fullscreen]="true">
<ion-button (click)="btnClicked()">Click Me</ion-button>

import the following:

import { ActivatedRoute } from '@angular/router';

Edit the MenuPage class to look like this. We are simply getting the value of URL parameter which is two that was set back in the

export class MenuPage implements OnInit {
    private activatedRoute:ActivatedRoute
  ) {
    // get the data from the URL
      (data=> {
    ); = this.activatedRoute.snapshot.paramMap.get('xyz');
  ngOnInit() {

Add a back button and display the URL parameter

  <ion-toolbar color="primary">
    <ion-buttons slot="start">
      <ion-back-button defaultHref="/"></ion-back-button>

<h1>Data = {{data}}</h1>