Моя ионная версия:
ionic (Ionic CLI) : 4.2.1
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Ошибка:
Error: C:\...\src\pages\buyer-form\buy-sell\buy-sell.ts has
a @IonicPage decorator, but it does not have a corresponding "NgModule" at
C:\...\src\pages\buyer-form\buy-sell\buy-sell.module.ts
Страница:
import { Component } from '@angular/core';
import {NavController, NavParams, ToastController, IonicPage} from 'ionic-angular';
import { Events } from 'ionic-angular';
@IonicPage({
name: 'BuySellPage',
priority: 'high'
})
@Component({
selector: 'page-buy-sell',
templateUrl: 'buy-sell.html',
})
export class BuySellPage {
constructor(public navCtrl: NavController, public navParams: NavParams,
public events: Events) {
}
}
Page.module:
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { ComponentsModule } from '../../../components/components.module';
import { BuySellPage } from './buy-sell';
@NgModule({
declarations: [
BuySellPage
],
imports: [
IonicPageModule.forChild(BuySellPage),
ComponentsModule,
],
exports: [
BuySellPage
],
entryComponents: [
BuySellPage
]
})
export class BuySellModule {}
App.module:
...
imports: [
...
IonicModule.forRoot(MyApp, {
mode: 'ios',
preloadModules: true
}),
...
BuySellModule ]
...
Кажется, я все сделал правильно, объявил module
в моем app.module
, затем в page.module
объявил page
и на странице написал @IonicPage
decorator. У этого page
есть свой собственный модуль, который объявляет страницу с: IonicPageModule.forChild(BuySellPage)
.
В чем проблема?
И нет, это не дублирующий вопрос от -> Этот вопрос , потому что я действительно сделал то же самое, что и большинство ответов.