ionic redirect to another page with params code example

Example 1: passing data from one page to another in ionic 4

import { Component } from '@angular/core';
import { Router, NavigationExtras } from '@angular/router';
import { DataService } from '../services/data.service';
 
@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
 
  user = {
    name: 'Simon Grimm',
    website: 'www.ionicacademy.com',
    address: {
      zip: 48149,
      city: 'Muenster',
      country: 'DE'
    },
    interests: [
      'Ionic', 'Angular', 'YouTube', 'Sports'
    ]
  };
 
  constructor(private router: Router, private dataService: DataService) { }
 
  openDetailsWithState() {
    let navigationExtras: NavigationExtras = {
      state: {
        user: this.user
      }
    };
    this.router.navigate(['details'], navigationExtras);
  }
}

Example 2: how to pass data to another page in ionic 3

Controller - 

this.navCtrl.push(page2,{
item:item,
item2:item2
});



View - 

this.value = navParams.get('item');