我对我的应用程序中的一个视图进行了一些小的更改,现在我遇到了致命的错误,如下所示:
Unexpected value 'undefined' declared by the module 'AppModule'
我已经检查过app.module中的周期性引用和问题,但是已经能够看到导致问题的任何内容。以下是崩溃后更改的类的功能
以下是我的医生:
populatePage(id){
console.log("single-test populate page testID");
console.log(id);
this.restService.getMedHist(id)
.then(data => {
console.log("patient data");
console.log(data);
this.medicalHistory = data;
this.obField = this.medicalHistory.ob;
this.gynField = this.medicalHistory.gyn;
this.pmhField = this.medicalHistory.pmh;
this.pshField = this.medicalHistory.psh;
this.medsField = this.medicalHistory.meds;
this.allField = this.medicalHistory.allVal;
this.shField = this.medicalHistory.sh;
console.log("data assigned");
}).catch(e => {
console.log(e);
});
}
REST的服务:
getMedHistory(id) {
return new Promise(resolve => {
this.http.get('/getMedHist/' + id)
.subscribe(data => {
console.log("rest-services.ts medHistory");
this.medHistData = data;
console.log(this.medHistData);
resolve(this.medHistData);
});
});
}
下面的是我的app.module.ts:
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { MedHist } from '../pages/medHist/medHist';
import { AuthService } from '../providers/auth/auth';
import { RestService } from '../providers/rest-service/rest-service';
import { ShareServiceProvider } from '../providers/share-service/share-service';
@NgModule({
declarations: [
MyApp,
AllPatientsPage,
MedHist
],
imports: [
BrowserModule,
HttpClientModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AllPatientsPage,
MedHist
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
ShareServiceProvider,
RestService
]
})
export class AppModule {}