# I can't Push a page with a parameter given in the html

**URL:** <https://forum.ionicframework.com/t/i-cant-push-a-page-with-a-parameter-given-in-the-html/88407>\
**Category:** ionic-v3\
**Created:** [April 30, 2017, 5:40pm UTC](https://forum.ionicframework.com/t/i-cant-push-a-page-with-a-parameter-given-in-the-html/88407 "2017-04-30T17:40:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Lu](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/julien_lu/32/108909_2.png) [@Julien\_Lu](https://forum.ionicframework.com/u/Julien_Lu)\
**Post date:** [April 30, 2017, 5:40pm UTC](https://forum.ionicframework.com/t/i-cant-push-a-page-with-a-parameter-given-in-the-html/88407/1 "2017-04-30T17:40:07Z")

</div>

When I click on an item, I’d like the name of the page be passed in a function goTo().

```auto
<ion-item (click)="goTo(Page1)"></ion item>

```

This function in particular who pushes the page.

```auto
import { Page1 } from '../page1/page1';

goTo (page) {
    this.navCtrl.push(page);
  }

```

It works if I replace page in push() by Page1 but I can’t pass the parameter. Why ?

---

<div class="post-metadata">

**Author:** ![SigmundFroyd](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sigmundfroyd/32/111604_2.png) [@SigmundFroyd](https://forum.ionicframework.com/u/SigmundFroyd)\
**Post date:** [April 30, 2017, 5:43pm UTC](https://forum.ionicframework.com/t/i-cant-push-a-page-with-a-parameter-given-in-the-html/88407/2 "2017-04-30T17:43:34Z")

</div>

Your template, i.e. your HTML, can only access what is defined in your page class. At the moment, you import `Page1` but it’s not defined in your class. So one solution would be to add the following into your class:

```auto
page1 = Page1;

```

Then in your HTML update it to:

```auto
<ion-item (click)="goTo(page1)"></ion item>

```

Alternatively, you could merely add a new function:

```auto
goToPage1() {
    this.navCtrl.push(Page1);
}

```

Add change your HTML to:

```auto
<ion-item (click)="goToPage1()"></ion item>

```

Personally I’m more of a fan of the latter, as it’s just a little more descriptive usually. Plus I don’t have to go about defining pages in my class.

---

<div class="post-metadata">

**Author:** ![Julien\_Lu](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/julien_lu/32/108909_2.png) [@Julien\_Lu](https://forum.ionicframework.com/u/Julien_Lu)\
**Post date:** [April 30, 2017, 5:45pm UTC](https://forum.ionicframework.com/t/i-cant-push-a-page-with-a-parameter-given-in-the-html/88407/3 "2017-04-30T17:45:15Z")

</div>

Thanks, it’s what I did but I thought it would be easier to have only one function with the page in parameter.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [April 30, 2017, 9:17pm UTC](https://forum.ionicframework.com/t/i-cant-push-a-page-with-a-parameter-given-in-the-html/88407/4 "2017-04-30T21:17:40Z")

</div>

There is another option, if you want to opt in to the lazy loading system. If you do that, you can navigate using strings, so `(click)="goTo('Page1')"` would work.
