无法解析Component的所有参数:(?,[object Object],[object Object])

时间:2018-01-21 07:38:21

标签: angular parameters components runtime

在Angular 4中,我定义了一个新组件并将其放在app.module.ts

  import {
BodyComponent,//new component
FooterComponent,
GlobalRestService,
HeaderComponent,
HttpService,
InsuranceSharedModule,
PreLoaderComponent,
PreloaderService,
} from './shared';

但是我遇到了以下错误。类似于GitHab中发生此错误。 https://github.com/ionic-team/ionic2-starter-aws/issues/34

compiler.es5.js:1694 Uncaught Error: Can't resolve all parameters for BodyComponent: (?, [object Object], [object Object]).
at syntaxError (compiler.es5.js:1694)
at CompileMetadataResolver._getDependenciesMetadata (compiler.es5.js:15781)
at CompileMetadataResolver._getTypeMetadata (compiler.es5.js:15649)
at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (compiler.es5.js:15244)
at CompileMetadataResolver.loadDirectiveMetadata (compiler.es5.js:15106)
at compiler.es5.js:26833
at Array.forEach (<anonymous>)
at compiler.es5.js:26832
at Array.forEach (<anonymous>)
at JitCompiler._loadModules (compiler.es5.js:26829)
at JitCompiler._compileModuleAndComponents (compiler.es5.js:26799)
at JitCompiler.compileModuleAsync (compiler.es5.js:26728)
at PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536)
at PlatformRef_.bootstrapModule (core.es5.js:4522)
at main (main.browser.ts:19)
at Object.<anonymous> (main.browser.ts:40)
at Object.module.exports (main.browser.ts:46)
at __webpack_require__ (bootstrap b82d5be055c3e9968a46:707)
at fn (bootstrap b82d5be055c3e9968a46:112)
at Object.defineProperty.value (TimerObservable.js:107)
at __webpack_require__ (bootstrap b82d5be055c3e9968a46:707)
at bootstrap b82d5be055c3e9968a46:805
at main.bundle.js:810[enter image description here][1]

1 个答案:

答案 0 :(得分:1)

我已经解决了,当我们在组件#include <QTime> 中定义navcontroller而未正确导入时会发生此错误。

在BodyComponent.ts中:

constructor

&#39; ../../../共享/服务&#39;网址不正确。