Q:

ionic 2 ViewController for popTo

I want to use popTo ( http://ionicframework.com/docs/v2/api/components/nav/NavController/#popTo ) in my ionic 2 application. Which requires a ViewController ( http://ionicframework.com/docs/v2/2.0.0-beta.7/api/components/nav/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 !!

A:

NavController.getByIndex(int index) returns a ViewController, so you can use: this.navCtrl.popTo(getByIndex(index)).
Don't forget to inject the NavControlelr properly
import { NavController } from 'ionic-angular';

class MyComponent {
  constructor(public navCtrl: NavController) {

  }
}

See here for Reference: 
http://ionicframework.com/docs/v2/api/navigation/NavController/#getByIndex

