一切都很好,今天我想用"离子构建ios" - 我过去很多时候都建立了这个应用程序 - 但现在我得到了
错误:无法确定组件GamePage的模块!
我该如何修复/调试它?
这是我的app.module.ts
import {NgModule, ErrorHandler} from '@angular/core';
import {IonicApp, IonicModule, IonicErrorHandler} from 'ionic-angular';
import {MyApp} from './app.component';
import {AboutPage} from '../pages/about/about';
import {ContactPage} from '../pages/contact/contact';
import {HomePage} from '../pages/home/home';
import {TabsPage} from '../pages/tabs/tabs';
import {LoginPage} from "../pages/login/login";
import {GamePage} from "../pages/game/game";
import {ShopPage} from "../pages/shop/shop";
import {RegisterPage} from "../pages/register/register";
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage,
GamePage,
ShopPage,
RegisterPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage,
GamePage,
ShopPage,
RegisterPage
],
providers: [
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {
}
这是我的tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5"
},
"include": [
"src/app/*.ts",
"src/pages/*.ts",
"www/assets/app/**/*.ts"
//"www/assets/app/**/**/*.ts"
],
"exclude": [
"node_modules"/*,
"www/assets/app/modules/exlude"*/
],
"compileOnSave": true,
"atom": {
"rewriteTsconfig": false
}
}
最后我的game.ts
import {Component} from '@angular/core';
import {NavController, MenuController, IonicApp} from 'ionic-angular';
import * as $ from 'jquery';
import {Lavoisier_ionic} from "../../../www/assets/app/Lavoisier_ionic";
import {MenuGame} from "../../../www/assets/app/modules/mod_menu_game/mod_menu_game";
import {Background} from "../../../www/assets/app/modules/mod_background/mod_background";
import {DataGuardian} from "../../../www/assets/app/modules/mod_data_guardian/mod_data_guardian";
import {Auth} from "../../../www/assets/app/modules/mod_auth/mod_auth";
import {User} from "../../../www/assets/app/modules/mod_user/mod_user";
import {StartGame} from "../../../www/assets/app/modules/mod_start_game/mod_start_game";
import {MenuInGame} from "../../../www/assets/app/modules/mod_menu_ingame/mod_menu_ingame";
import {Body} from "../../../www/assets/app/modules/mod_body/mod_body";
import {MenuCasClinique} from "../../../www/assets/app/modules/mod_menu_cas_clinique/mod_menu_cas_clinique";
import {DossierPatient} from "../../../www/assets/app/modules/mod_dossier_patient/mod_dossier_patient";
import {Hypothese} from "../../../www/assets/app/modules/mod_hypothese/mod_hypothese";
import {InterrogatoirePlayground} from "../../../www/assets/app/modules/mod_interrogatoire_playground/mod_interrogatoire_playground";
import {Interrogatoire} from "../../../www/assets/app/modules/mod_interrogatoire/mod_interrogatoire";
import {ExamenPhysique} from "../../../www/assets/app/modules/mod_examen_physique/mod_examen_physique";
import {ConstantesVitales} from "../../../www/assets/app/modules/mod_constantes_vitales/mod_constantes_vitales";
import {Scoring} from "../../../www/assets/app/modules/mod_scoring/mod_scoring";
import {Bilan} from "../../../www/assets/app/modules/mod_bilan/mod_bilan";
import {Countdown} from "../../../www/assets/app/modules/mod_countdown/mod_countdown";
import {Correct} from "../../../www/assets/app/modules/mod_correct/mod_correct";
import {Diagnostic} from "../../../www/assets/app/modules/mod_diagnostic/mod_diagnostic";
import {ActionsDangereuses} from "../../../www/assets/app/modules/mod_actions_dangereuses/mod_actions_dangereuses";
import {EndGame} from "../../../www/assets/app/modules/mod_end_game/mod_end_game";
import {Exploration} from "../../../www/assets/app/modules/mod_exploration/mod_exploration";
import {ExplorationPlayground} from "../../../www/assets/app/modules/mod_exploration_playground/mod_exploration_playground";
import {Http} from "@angular/http";
import {Fondamental} from "../../../www/assets/app/modules/mod_fondamental/mod_fondamental";
import {Help} from "../../../www/assets/app/modules/mod_help/mod_help";
import {MesuresUrgencesPlayground} from "../../../www/assets/app/modules/mod_mesures_urgences_playground/mod_mesures_urgences_playground";
import {MesuresUrgences} from "../../../www/assets/app/modules/mod_mesures_urgences/mod_mesures_urgences";
import {LowTime} from "../../../www/assets/app/modules/mod_low_time/mod_low_time";
import {NotePad} from "../../../www/assets/app/modules/mod_notepad/mod_notepad";
import {OpenNotePad} from "../../../www/assets/app/modules/mod_button_open_notepad/mod_button_open_notepad";
import {SaveDB} from "../../../www/assets/app/modules/mod_savedb/mod_savedb";
import {Modal} from "../../../www/assets/app/modules/mod_modal/mod_modal";
import {Storage} from '@ionic/storage';
/*
Generated class for the Game page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-game',
templateUrl: 'game.html',
providers: [Storage]
})
export class GamePage {
lavoisier_ionic: any;
constructor(public navCtrl: NavController, storage: Storage, public http: Http, public menuCtrl: MenuController,app:IonicApp) {
var that = this;
var publickey;
$(document).ready(function () {
storage.get('publickey').then((val) => {
publickey = val;
that.lavoisier_ionic = new Lavoisier_ionic(http,app,navCtrl);
that.lavoisier_ionic.addModule(new DataGuardian(that.lavoisier_ionic, http, publickey));
that.lavoisier_ionic.addModule(new Auth(that.lavoisier_ionic, http, publickey));
that.lavoisier_ionic.addModule(new User(that.lavoisier_ionic, http));
that.lavoisier_ionic.addModule(new Background(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new MenuGame(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new StartGame(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Body(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new MenuCasClinique(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new MenuInGame(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new DossierPatient(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Hypothese(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new InterrogatoirePlayground(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Interrogatoire(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new ExamenPhysique(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new ConstantesVitales(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Scoring(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Bilan(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Countdown(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Correct(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Diagnostic(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new ActionsDangereuses(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new EndGame(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Exploration(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new ExplorationPlayground(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Fondamental(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Help(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new MesuresUrgencesPlayground(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new MesuresUrgences(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new LowTime(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new NotePad(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new OpenNotePad(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new Modal(that.lavoisier_ionic));
that.lavoisier_ionic.addModule(new SaveDB(that.lavoisier_ionic));
that.lavoisier_ionic.init();
that.lavoisier_ionic.render();
});
});
}
}
答案 0 :(得分:2)
我发现了这个问题!我在非角度模块中导入角度分量。正如错误所说:无法确定组件GamePage的模块!
答案 1 :(得分:0)
在我的情况下,我有三个同名的班级(由团队成员添加),只导入一个。我不得不更改名称并导入AppModule中的剩余部分。然后问题就解决了。
我相信每当我们添加任何组件,指令,管道或者我们是否使用它们时,我们必须添加到导入,否则将出现此错误。