Angular 错误:有一个@IonicPage装饰符,但没有相应的";NgModule";
C:\wamp\www\Ionic4\ionic3-angular4\src\pages\home\home.ts具有 @IonicPage decorator,但它没有相应的“NgModule” 位于C:\wamp\www\Ionic4\ionic3-angular4\src\pages\home\home.module.ts home.ts home.module.tsAngular 错误:有一个@IonicPage装饰符,但没有相应的";NgModule";,angular,typescript,ionic3,Angular,Typescript,Ionic3,C:\wamp\www\Ionic4\ionic3-angular4\src\pages\home\home.ts具有 @IonicPage decorator,但它没有相应的“NgModule” 位于C:\wamp\www\Ionic4\ionic3-angular4\src\pages\home\home.module.ts home.ts home.module.ts 您的home.module.ts应该如下所示。您错过了@NgModule上的一些属性。您不需要在module.ts文件中使
您的
home.module.ts
应该如下所示。您错过了@NgModule
上的一些属性。您不需要在module.ts
文件中使用entryComponents:[主页]
。因此,请按如下所示进行尝试
注意:+关键问题是缺少导出
数组
home.module.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { IonicPage } from 'ionic-angular';
@IonicPage({
name: 'home'
})
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController) {
}
}
import { NgModule } from '@angular/core';
import { HomePage} from './home';
import { IonicPageModule } from 'ionic-angular';
@NgModule({
declarations: [HomePage],
imports: [IonicPageModule.forChild(HomePage)],
entryComponents: [HomePage]
})
export class HomePageModule { }
import { NgModule } from '@angular/core';
import { HomePage} from './home';
import { IonicPageModule } from 'ionic-angular';
@NgModule({
declarations: [
HomePage
],
imports: [
IonicPageModule.forChild(HomePage),
],
exports: [
HomePage
]
})
export class HomePageModule { }