ViewController and popTo ionic

I want to use popTo ( ) in my ionic 2 application. Which requires a ViewController ( )

I am not able to figure out how to create a page as a ViewController that is usable in popTo with the documents present over the internet.

Has someone used popTo ? any heads up !!

Can you share what you’ve tried?

popTo should be usable inside any @Page as long as there is history to go back to.

I have three pages Home, Page2 and Page3.
I push from home to Page 2
Push from Page 2 to Page 3
PopTo from Page 3 to Home
(on button click event)


import {Page, NavController, ViewController, Modal} from 'ionic-angular';
import {Page2} from './page2';

  templateUrl: 'build/pages/home/home.html'
export class HomePage {
  static get parameters() {
    return [[NavController], [ViewController]];

  constructor(public nav,public viewCtrl) {
    this.viewCtrl = viewCtrl;
    this.nav = nav;
  gotopage2() {


import {Page, NavController} from 'ionic-angular';
import {Page3} from './page3';

  templateUrl: 'build/pages/home/page2.html'
export class Page2 {
   constructor(private nav: NavController) {

  gotopage3() {


import {Page, NavController, ViewController} from 'ionic-angular';
import {HomePage} from './home';

  templateUrl: 'build/pages/home/page3.html'
export class Page3 {
  constructor(private nav: NavController) {
  gotohome() {
     //Error: [ts] Argument of type 'typeof HomePage' is not assignable to parameter of type 'ViewController'.
     //Property 'componentType' is missing in type 'typeof HomePage'.

There is history to go back to I can see in the browser’s developer console.
Am I missing on something?

Ahh, looks like i missed an issue.

Looks like this is a known issue.
Let’s move the discussion over there.

Seems to work fine for me.
I created the viewCtrl reference whilst on page 1 (e.g. popBack:this.viewCtrl), kept the reference by passing through as a navParam across all navigation and then simply called nav.popTo(this.navParams.popBack) and works.

Hope this helps, if you still have problems let me know

Hi @chrismclarke could you please provide the full code? Needless to say that Ionic 2 Examples are a rare breed out there.

On second thoughts you only need to use navParams if you want to track page history (i.e. have a new back button appear on the home page to take you back to page 3). I imagine this isn’t what is wanted and instead just use the following code:


 gotohome() {

hey please share code for popTo().

1 Like

The documentation for this method has been pulled from the ionic website (see here). @mharingon, WTF?

Here’s the solution -

// Move back two places.

FIX THE SIGNATURE IF IT DOESN’T TAKE STRINGS!!! Really losing faith in basic ionic functionality at this point…