Reputation: 11
How can I navigate to the root page with ionic 2, when i use this code :
this.navCtrl.push('HomePage');
it made the error below
Uncaught (in promise): invalid link: HomePage
Upvotes: 0
Views: 599
Reputation: 1301
First Check your page component if you have
import { IonicPage } from 'ionic-angular';
and because your using lazy page loading you should have this. @ionicpage
@IonicPage()
@Component({
....
})
last resort is try to resart or reset your ionic serve. sometimes it happen . and i think its ionic bug. but no big deal.
Upvotes: 0
Reputation: 6421
You can use this.navCtrl.popToRoot();
, It'll pop all views and there's no need to set a new root. This'll also not fire some lifecycle hooks like ionViewDidLoad()
and ionViewWillLoad()
.
Hope this helps.
Upvotes: 0