当我运行我的代码时,编译器很高兴但是Web控制台在下面给出了这个错误。根据错误,我假设我在app.module文件中有一个错误,它有或正在丢失一些东西,但我无法弄清楚是什么。以下是错误和我的app.module文件。
Error: Unexpected value 'id' declared by the module 'AppModule' vendor.bundle.js:237504:21
ZoneAwareError http://localhost:4200/vendor.bundle.js:237504:21
CompileMetadataResolver.prototype.getNgModuleMetadata/< http://localhost:4200/vendor.bundle.js:25675:40
forEach self-hosted:252:13
CompileMetadataResolver.prototype.getNgModuleMetadata http://localhost:4200/vendor.bundle.js:25673:13
JitCompiler.prototype._loadModules http://localhost:4200/vendor.bundle.js:63174:41
JitCompiler.prototype._compileModuleAndComponents http://localhost:4200/vendor.bundle.js:63134:47
JitCompiler.prototype.compileModuleAsync http://localhost:4200/vendor.bundle.js:63100:16
PlatformRef_.prototype._bootstrapModuleWithZone http://localhost:4200/vendor.bundle.js:48289:16
PlatformRef_.prototype.bootstrapModule http://localhost:4200/vendor.bundle.js:48264:16
[827] http://localhost:4200/main.bundle.js:6872:1
__webpack_require__ http://localhost:4200/inline.bundle.js:53:12
[1529] http://localhost:4200/main.bundle.js:881:18
__webpack_require__ http://localhost:4200/inline.bundle.js:53:12
webpackJsonpCallback http://localhost:4200/inline.bundle.js:24:23
<anonymous>
App模块
/* !!! System Imports !!! */
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
//Needed for special routes handling -
import { routing } from './app.routing';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
];
import { TabsModule, PaginationModule, BsDropdownModule } from 'ng2-bootstrap';
import { Ng2TableModule } from 'ng2-table/ng2-table';
import { ModalModule } from 'ng2-bootstrap/modal';
//Third Party Components
import { CookieService } from 'angular2-cookie/core';
import { FileSelectDirective, FileDropDirective, FileUploader } from 'ng2-file-upload';
import { ChartsModule } from 'ng2-charts';
import { Ng2Bs3ModalModule } from 'ng2-bs3-modal/ng2-bs3-modal';
import {ToastModule} from 'ng2-toastr';
/* *** Project Imports *** */
//Our Own App Services/Components
import { UserAuthService } from './services/user-auth.service';
import { RenewalDocumentService } from './services/renewal-document.service';
import { RenewalOptionsService } from './services/renewal-options.service';
import { RememberMeService } from './services/remember-me.service';
import { AppMessagingService } from './services/app-messaging.service';
import { UserProfileComponent } from './userarea/user-profile.component';
import { UserLoginComponent } from './userarea/user-login.component';
import { UserLogoutComponent } from './userarea/user-logout.component';
import { HomePageComponent } from './userarea/home-page.component';
import { DocumentClassViewComponent } from './userarea/document-class-view.component';
import { DocumentClassWithUpdatesComponent } from './userarea/document-class-with-updates.component';
import { FileUploadComponent} from './userarea/file-upload.component';
import { ZipsUploadComponent} from './userarea/zips-upload.component';
import { UserGuideUploadComponent} from './userarea/userguide-upload.component';
import { SimpleDemoComponent} from './userarea/simple-demo';
import { RenewalClassificationListComponent } from './userarea/renewal-classification-list.component';
import { ZipListComponent } from './userarea/zip-list.component';
import { ZipYearComponent } from './userarea/zip-year.component';
import { RenewalCatFileistComponent } from './userarea/renewal-cat-filelist.component';
import { AdminFileListComponent } from './userarea/admin_options/admin-file-list.component';
import { AdminFileRowComponent } from './userarea/admin_options/admin-file-row.component';
import { DisclaimerComponent } from './userarea/disclaimer.component';
import { ContactUsComponent } from './userarea/contact-us.component';
import { PrivacyPolicyComponent } from './userarea/privacy-policy.component';
import { TsAndCsComponent } from './userarea/ts-and-cs.component';
import { FaqsComponent } from './userarea/faqs.component';
import { WebLinksComponent } from './userarea/web-links.component';
import { CurrentYearViewComponent } from './userarea/current-year-view.component';
import { RenewalYearViewComponent } from './userarea/renewal-year-view.component';
import { RenewalYearSummaryComponent } from './userarea/renewal-year-summary.component';
import { ArchiveYearsViewComponent } from './userarea/archive-years-view.component';
import { UpdatesClassesViewComponent } from './userarea/updates-classes-view.component';
import { UpdatesClassViewComponent } from './userarea/updates-class-view.component';
import { UpdatesClassificationListComponent } from './userarea/updates-classification-list.component';
import { UpdatesCatFileistComponent } from './userarea/updates-cat-filelist.component';
import { UrllinkResetPasswordComponent } from './userarea/urllink-reset-password.component';
import { UrllinkActivateUserComponent } from './userarea/urllink-activate-user.component';
import { AdminOptionsComponent } from './userarea/admin_options/admin-options.component';
import { AdminUserListComponent } from './userarea/admin_options/admin-user-list.component';
import { AdminUserRowComponent } from './userarea/admin_options/admin-user-row.component';
import { AccessLogComponent } from './userarea/admin_reports/access-log.component';
import { DocSearchComponent } from './userarea/doc-search.component';
import { NavBarComponent } from './userarea/nav-bar.component';
import { NavBarRightComponent } from './userarea/nav-bar-right.component';
import { AdminBatchUserCreateComponent } from './userarea/admin_options/admin-batch-user-create.component';
import { AdminManageUserComponent } from './userarea/admin_options/admin-manageuser.component';
import { UserChangepasswordComponent } from './userarea/user-changepassword.component';
import { UserForgottenpasswordComponent } from './userarea/user-forgottenpassword.component';
import { AdminAppConfigComponent } from './userarea/admin_options/admin-app-config.component';
import { AdminGraphFileViewComponent } from './userarea/admin_reports/admin-graph-file-view.component';
// ADS added
//import { AdminUserTableComponent } from './userarea/admin_options/admin-user-table.component';
import { AdminUserTableComponent } from './adminusertable/adminusertable.component';
import { AdminUserReportComponent } from './userarea/admin_options/admin-userreport.component';
import { AdminReportByUserComponent } from './userarea/admin_reports/admin-reportbyuser.component';
import { AdminReportsComponent } from './userarea/admin_reports/admin-reports.component';
import { AdminNewFileListComponent } from './userarea/admin_options/admin-newfile-list.component';
import { AdminNewFileRowComponent } from './userarea/admin_options/admin-newfile-row.component';
import { AdminNewUserTableComponent } from './userarea/admin_options/admin-newuser-table.component';
import { NewUserTablecolumnsComponent } from './grid/NewUserGrid/newusertablecolumns.component';
//Angular CLI bootstrapping the App
import { AppComponent } from './app.component';
import { ToasterModule, ToasterService } from 'angular2-toaster';
import { DataTablesModule } from 'angular-datatables';
import { MultiselectDropdownModule } from 'angular-2-dropdown-multiselect';
// import { UserFilter } from '../_directives/UserFilter';
// import { AuthGuard } from '../guards/index';
import { ExportToExcel } from './services/index'; // EmailService, EventService,
import { NewUserGrid} from './grid/index';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
declarations:
[
/* App Components*/
AppComponent,
/* Other project components*/
UserLoginComponent, UserLogoutComponent, HomePageComponent, FileUploadComponent, ZipsUploadComponent, UserGuideUploadComponent, DocumentClassViewComponent,
SimpleDemoComponent, FileSelectDirective, RenewalClassificationListComponent, RenewalCatFileistComponent, DisclaimerComponent, RenewalYearViewComponent,
ArchiveYearsViewComponent, RenewalYearSummaryComponent, CurrentYearViewComponent, UpdatesClassesViewComponent, UpdatesClassViewComponent,
UpdatesClassificationListComponent, UpdatesCatFileistComponent, UrllinkResetPasswordComponent, UrllinkActivateUserComponent, NavBarComponent,
NavBarRightComponent, UserChangepasswordComponent, UserForgottenpasswordComponent, ContactUsComponent, PrivacyPolicyComponent, TsAndCsComponent, FaqsComponent,
WebLinksComponent, DocumentClassWithUpdatesComponent, UserProfileComponent, ZipListComponent, ZipYearComponent, DocSearchComponent,
/* Admin Option Components*/
AdminOptionsComponent, AdminUserListComponent, AdminBatchUserCreateComponent, AdminFileListComponent, AdminFileRowComponent, AdminUserTableComponent, AdminManageUserComponent,
/* Admin Report Components */
AccessLogComponent,AdminUserRowComponent, AdminGraphFileViewComponent, AdminAppConfigComponent, AdminUserReportComponent, AdminReportByUserComponent,
AdminReportsComponent,
AdminNewFileListComponent, AdminNewFileRowComponent, AdminNewUserTableComponent, AdminUserTableComponent, NewUserTablecolumnsComponent,
FileDropDirective, FileUploader, ToasterModule, ToasterService, DataTablesModule, MultiselectDropdownModule, ExportToExcel, NewUserGrid
//ADS. We no longer use these files
//BasicSingleFileComponent,
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
ReactiveFormsModule,
routing,
ToastModule,
ChartsModule,
ModalModule.forRoot(),
BsDropdownModule,
TabsModule,
Ng2Bs3ModalModule,
PaginationModule.forRoot(),
RouterModule.forRoot(routes, { useHash: true }),
Ng2TableModule
],
providers: [ UserAuthService,
RenewalDocumentService,
RenewalOptionsService,
AppMessagingService,
CookieService,
RememberMeService
],
bootstrap: [AppComponent]
})
export class AppModule { }
如果有人可以请求我如何调试这个,我们将不胜感激
有任何建议吗?
由于
答案 0 :(得分:0)
在导入部分中,您使用的是routing
和
RouterModule.forRoot(routes, { useHash: true }),
请使用任何一个。要么将路由模块分开,要么将它放在同一个appmodule中。
imports: [
BrowserModule,
FormsModule,
HttpModule,
ReactiveFormsModule,
routing,
ToastModule,
ChartsModule,
ModalModule.forRoot(),
BsDropdownModule,
TabsModule,
Ng2Bs3ModalModule,
PaginationModule.forRoot(),
RouterModule.forRoot(routes, { useHash: true }),
Ng2TableModule
],
将routing
保留在导入部分的最后一个模块中。