Nicht abgefangene Fehler: Unerwarteter Richtlinie "MyComboBox" importiert durch das Modul 'AppModule'. Fügen Sie bitte ein @NgModule annotation

Habe ich eine benutzerdefinierte Komponente (MyComboBox), die kendo-combobox-innen.

Wenn ich mit meinem core-Modul, webpack Zusammenstellung endet erfolgreich, aber chrome wirft die folgende Fehlermeldung:

Uncaught Error: Unexpected directive 'MyComboBox' imported by the module 'AppModule'. Please add a @NgModule annotation.
    at syntaxError (eval at <anonymous> (http://localhost:8086/vendor.js:1354:1), <anonymous>:1682:34) [<root>]
    at eval (eval at <anonymous> (http://localhost:8086/vendor.js:1354:1), <anonymous>:14149:44) [<root>]
    at Array.forEach (native) [<root>]
    at CompileMetadataResolver.getNgModuleMetadata (eval at <anonymous> (http://localhost:8086/vendor.js:1354:1), <anonymous>:14132:49) [<root>]
    at JitCompiler._loadModules (eval at <anonymous> (http://localhost:8086/vendor.js:1354:1), <anonymous>:25313:64) [<root>]
    at JitCompiler._compileModuleAndComponents (eval at <anonymous> (http://localhost:8086/vendor.js:1354:1), <anonymous>:25272:52) [<root>]
    at JitCompiler.compileModuleAsync (eval at <anonymous> (http://localhost:8086/vendor.js:1354:1), <anonymous>:25234:21) [<root>]
    at PlatformRef_._bootstrapModuleWithZone (eval at <anonymous> (http://localhost:8086/vendor.js:16:1), <anonymous>:4992:25) [<root>]
    at PlatformRef_.bootstrapModule (eval at <anonymous> (http://localhost:8086/vendor.js:16:1), <anonymous>:4978:21) [<root>]
    at eval (eval at <anonymous> (http://localhost:8086/app.js:4275:1), <anonymous>:10:53) [<root>]
    at Object.<anonymous> (http://localhost:8086/app.js:4275:1) [<root>]
    at __webpack_require__ (http://localhost:8086/polyfills.js:53:30) [<root>]
    at Object.<anonymous> (http://localhost:8086/app.js:8253:18) [<root>]
    at __webpack_require__ (http://localhost:8086/polyfills.js:53:30) [<root>]
ZoneAwareError @ zone.js?fad3:917
syntaxError @ VM3491:1682
(anonymous) @ VM3491:14149
CompileMetadataResolver.getNgModuleMetadata @ VM3491:14132
JitCompiler._loadModules @ VM3491:25313
JitCompiler._compileModuleAndComponents @ VM3491:25272
JitCompiler.compileModuleAsync @ VM3491:25234
PlatformRef_._bootstrapModuleWithZone @ core.es5.js?0445:4992
PlatformRef_.bootstrapModule @ core.es5.js?0445:4978
(anonymous) @ main.ts?5861:11
(anonymous) @ app.js:4275
__webpack_require__ @ polyfills.js:53
(anonymous) @ app.js:8253
__webpack_require__ @ polyfills.js:53
webpackJsonpCallback @ polyfills.js:24
(anonymous) @ app.js:1

Hier ist mein AppModule:

app.- Modul.ts

import { MyComboBox } from '@my/core/control/MyComboBox';

@NgModule({
    declarations: [
        AppComponent,
        MyComboBox
    ],
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        DragulaModule,
        MyComboBox,
        CoreModule,
        ComboBoxModule
    ],
    entryComponents: [ MyComboBox ],
    //viewProviders: [ DragulaService ],
    providers: [HelperService],
    bootstrap: [AppComponent]
})
Sollten Sie den Import-Core-Modul statt MyComboBox. Können Sie zeigen, wie Sie exportiert haben, und erklärt MyComboBox?
import { ComboBoxModule } '@progress/kendo-angular-dropdowns';
Meine Frage war, wo haben Sie den export MyComboBox? Ich meine, in welchem Modul? Können Sie das bitte zeigen.
import { ComboBoxModule } '@progress/kendo-angular-dropdowns'; import { ... MyComboBox, ... } ... @NgModule({ Importe: [ ... ComboBoxModule, ... ], ... exportiert: [ ... MyComboBox, ... ] Erklärungen: [ ... MyComboBox, ... ],
Es ist mein core-Modul.

InformationsquelleAutor Hamit | 2017-04-25

Schreibe einen Kommentar