Ionic Uncaught (in promise): invalid link

扶醉桌前 提交于 2019-12-01 04:07:18

what you need to do is to add @IonicPage() before '@Component' and import 'IonicPage' like this : import {NavController, IonicPage} from 'ionic-angular';

then you need to create a module for the homepage i.e in the home directory , create home.module.ts with the following contents

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { HomePage } from './home';

@NgModule({
  declarations: [
    HomePage
  ],
  imports: [
    IonicPageModule.forChild(HomePage),
  ],
  exports: [
    HomePage
  ]
})
export class HomePageModule {}

and reload the project

amyogiji

The only problem in your code is when you write this.nav.push('HomePage'); remove the ' ' quotes when calling any page, and write like this.

this.nav.push(HomePage); without quotes.

Above answer is for ionic2, in ionic3 there is lazy loading where you call like this this.nav.push('HomePage');

I copied login example. The error is similar.

Check points for HomePage : (1) check whether home.module.ts is (2) check @IonicPage() before '@Component' in home.ts (2) remove HomePage from declaration/entryComponents in app.module.ts when facing open-error

Just add @IonicPage() before @component in ts file for example:

@IonicPage() @Component({ selector: 'page-wall', templateUrl: 'wall.html', })

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!