Page has a @IonicPage decorator, but it does not have a corresponding “NgModule”

后端 未结 11 2482
花落未央
花落未央 2020-12-16 11:06

I was working on page navigation in Ionic. After using ionic serve, I got this error:

The Page with .ts extension has a @IonicPage decorator, but

11条回答
  •  北海茫月
    2020-12-16 11:48

    In your .ts page add the following code, replace the word 'name' with whatever you name your page. Don't forget to add your new page in the app.module.ts page.

    import { Component } from '@angular/core';
    import { NavController } from 'ionic-angular';
    
    @Component({
    selector: 'page-name',
    templateUrl: 'name.html',
    })
    
    export class NamePage {
       constructor(public navCtrl: NavController) {
      }
    }
    

提交回复
热议问题