# How to pass data to pages and get data

**URL:** <https://forum.ionicframework.com/t/how-to-pass-data-to-pages-and-get-data/138338>\
**Category:** Ionic Framework\
**Created:** [August 14, 2018, 5:35am UTC](https://forum.ionicframework.com/t/how-to-pass-data-to-pages-and-get-data/138338 "2018-08-14T05:35:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pancha27](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Pancha27](https://forum.ionicframework.com/u/Pancha27)\
**Post date:** [August 14, 2018, 5:35am UTC](https://forum.ionicframework.com/t/how-to-pass-data-to-pages-and-get-data/138338/1 "2018-08-14T05:35:23Z")

</div>

Ionic V3 use  
pass;

`this.navCtrl.push(SearchPage, { data: this.pageName });`

get;

```auto
this.page = navParams.get('data');

```

but V4 can’t access push and navParams. How to do it? Please help

---

<div class="post-metadata">

**Author:** ![AaronSterling](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AaronSterling](https://forum.ionicframework.com/u/AaronSterling)\
**Post date:** [August 14, 2018, 5:39am UTC](https://forum.ionicframework.com/t/how-to-pass-data-to-pages-and-get-data/138338/2 "2018-08-14T05:39:29Z")

</div>

Modals and popovers can. More generally: use a provider. Group pages by functionality, the foo function, and build a FooDataProvider, which is the central brain for all things foo, and the foo pages ask it for information as needed.

---

<div class="post-metadata">

**Author:** ![Pancha27](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Pancha27](https://forum.ionicframework.com/u/Pancha27)\
**Post date:** [August 16, 2018, 3:51am UTC](https://forum.ionicframework.com/t/how-to-pass-data-to-pages-and-get-data/138338/3 "2018-08-16T03:51:11Z")

</div>

app.routing.module.ts

```auto
const routes: Routes = [
  { path: '', loadChildren: './tabs/tabs.module#TabsPageModule' },
  { path: 'pageName/:variable1/:variable2', loadChildren: './pages/path/pageName.module#PageNamePageModule' },
];

```

page.ts

```auto
this.navCtrl.goForward('path/' + this.variable1 + '/' + this.variable2);

```

then

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

constructor(public navCtrl: NavController, private route: ActivatedRoute,){
    this.getData();
}

getData(){
    this.selected_pipeline = this.route.snapshot.paramMap.get('variable1');
    this.selected_stage = this.route.snapshot.paramMap.get('variable2');
}

```

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:25pm UTC](https://forum.ionicframework.com/t/how-to-pass-data-to-pages-and-get-data/138338/4 "2021-07-19T21:25:36Z")

</div>


