Yokesh Varadhan
Yokesh Varadhan

Reputation: 1636

page navigation error with nav controller

I downloaded ionic 2 project like

ionic start myProj tabs --v2 --ts

i created a button and in ts page i made control for it

    import { Component } from '@angular/core';
import { NavController} from 'ionic-angular';
import { HomePage } from '../pages/home/home';

@Component({

  templateUrl: 'login.html'
})
export class LoginPage {

  constructor(public nav: NavController) {
    this.nav = nav;
  }


  login(){
    console.log("login clicked");
    this.nav.push(HomePage);
  }

}

my html is

<ion-content padding>
    <button ion-button block (click)="login()" style="text-transform: none;">Login</button>
</ion-content>

when i run this i get an uncaught error

main.js:55978 Uncaught Error: Cannot find module "../pages/home/home"

what is my problem could someone help me

Upvotes: 0

Views: 464

Answers (1)

Suraj Rao
Suraj Rao

Reputation: 29614

Your import is incorrect.

If you have placed LoginPage inside pages folder,

import { HomePage  } from '../home/home';

Upvotes: 1

Related Questions