Angular 2 Uncaught没有ExceptionHandler的提供者!在AOT模式下编译时

时间:2016-08-30 21:33:59

标签: angular

在aot(提前)编译我的angular2应用程序时,它很好用,但是当我重新加载页面时,我在bootstrap上遇到控制台错误Uncaught没有ExceptionHandler的提供程序!。

如果我正常引导它,我不会收到此错误。有没有人知道我是否需要添加到ExceptionHandler的模块中?

我有两个模块文件。 app.module是在main.ts中引导的那个

app.module.ts:

    @NgModule({
    declarations: [
        App,
        Layout,
        FormBuilder,
        FormPreview,
        Forms,
        Form,
        RequestTask,
        TaskList,
        Profile,
        Home,
        AssetLibraryDepricate,
        BCIndex,
        UsersList,
        TeamsList,
        GroupsList,
        DownloadRules,
        CustomLogin,
        Themes,
        RegistrationRules,
        RegistrationForms,
        Watermark,
        MetadataSchema,
        SystemPreferences,
        CoreReports,
        AuditLogger,
        TaskDetail,
        WipHeader,
        AdminHeader,
        CoreIframe
    ],
    imports:[
        routing,
        SharedModule.forRoot()
    ],
    providers:[
        ApiService
    ],
    bootstrap:    [App],
})
export class AppModule {}

shared.module.ts:

@NgModule({
    declarations: [
        OrderByDatePipe,
        OrderByPipe,
        MomentPipe,
        Truncate,
        ExtRemove,
        ConvertTimestamp,
        CapitalizeFirst,
        FilterDropDown,
        SideBar,
        Loader,
        ActionBar,
        KabobDropDown,
        UserPill,
        UserSelect,
        UserDropDown,
        BuildCheckBox,
        BuildRadio,
        BuildSelect,
        TaggleDirective,
        AutoCompleteDirective,
        DropzoneDirective,
        ListView,
        TextDropDown,
        TitleWidget,
        ShortAnswerWidget,
        LongAnswerWidget,
        CheckboxWidget,
        MultipleChoiceWidget,
        DropdownWidget,
        DateWidget,
        AttachmentWidget,
        ImageWidget,
        ImagePanelWidget,
        DescriptionWidget,
        KeywordsWidget,
        Alert,
        AdminTitleWidget,
        AdminAssignWidget,
        AssignWidget,
        AdminShortAnswerWidget,
        AdminLongAnswerWidget,
        AdminCheckboxWidget,
        AdminMultipleChoiceWidget,
        AdminDropdownWidget,
        AdminDateWidget,
        AdminAttachmentWidget,
        AdminImageWidget,
        AdminDescriptionWidget,
        AdminKeywordsWidget,
        ImagePanelWidget,
        WidgetDrawer,
        SortableDirective,
        NavLogin,
        NavLightbox,
        NavNotifcations,
        Logo,
        ProfileWidget,
        CreateTask,
        MetadataXmp,
        MetadataExif,
        MetadataKeywords,
        AssetDetail,
        AssetLibrary,
        AssetLibraryContainer,
        ActionNav,
        Tabs,
        Tab,
        UserInfo,
        UserNotifications,
        UserRegion,
        UserDownloadHistory,
        UserAddressBook,
        States,
        Countries,
        UserImage,
        UserPassword,
        Language,
        Timezones,
        PikaDirective,
        QuillDirective,
        SwiperJSDirective,
        CheckBox,
        Radio,
        WebdamSelect,
        WebdamInput,
        WebdamTextarea
    ],
    imports:[
        BrowserModule,
        FormsModule,
        CommonModule,
        RouterModule,
        ReactiveFormsModule,
        HttpModule
    ],
    exports:[
        OrderByDatePipe,
        OrderByPipe,
        MomentPipe,
        Truncate,
        ExtRemove,
        ConvertTimestamp,
        CapitalizeFirst,
        FilterDropDown,
        FormsModule,
        CommonModule,
        RouterModule,
        ReactiveFormsModule,
        SideBar,
        Loader,
        ActionBar,
        KabobDropDown,
        UserPill,
        UserSelect,
        UserDropDown,
        BuildCheckBox,
        BuildRadio,
        BuildSelect,
        TaggleDirective,
        AutoCompleteDirective,
        DropzoneDirective,
        ListView,
        TextDropDown,
        TitleWidget,
        ShortAnswerWidget,
        LongAnswerWidget,
        CheckboxWidget,
        MultipleChoiceWidget,
        DropdownWidget,
        DateWidget,
        AttachmentWidget,
        ImageWidget,
        ImagePanelWidget,
        DescriptionWidget,
        KeywordsWidget,
        Alert,
        AdminTitleWidget,
        AdminAssignWidget,
        AssignWidget,
        AdminShortAnswerWidget,
        AdminLongAnswerWidget,
        AdminCheckboxWidget,
        AdminMultipleChoiceWidget,
        AdminDropdownWidget,
        AdminDateWidget,
        AdminAttachmentWidget,
        AdminImageWidget,
        AdminDescriptionWidget,
        AdminKeywordsWidget,
        ImagePanelWidget,
        WidgetDrawer,
        SortableDirective,
        NavLogin,
        NavLightbox,
        NavNotifcations,
        Logo,
        ProfileWidget,
        CreateTask,
        MetadataXmp,
        MetadataExif,
        MetadataKeywords,
        AssetDetail,
        AssetLibrary,
        AssetLibraryContainer,
        ActionNav,
        Tabs,
        Tab,
        UserInfo,
        UserNotifications,
        UserRegion,
        UserDownloadHistory,
        UserAddressBook,
        States,
        Countries,
        UserImage,
        UserPassword,
        Language,
        Timezones,
        PikaDirective,
        QuillDirective,
        SwiperJSDirective,
        CheckBox,
        Radio,
        WebdamSelect,
        WebdamInput,
        WebdamTextarea

    ]
})
export class SharedModule {
    static forRoot(): ModuleWithProviders {
    return {
      ngModule: SharedModule,
      providers: [
          EventService,
          SharedApiService,
          AssetChooserService,
          I18nService,
          AlertType,
          Asset,
          HeaderType,
          LogoType,
          MetaData,
          SiteFeatures,
          TaskType,
          User,
          Widget

      ]
    };
  }
}

0 个答案:

没有答案