Reputation: 396
In Angular 4 I have defined a new component and put it in the app.module.ts
import {
BodyComponent,//new component
FooterComponent,
GlobalRestService,
HeaderComponent,
HttpService,
InsuranceSharedModule,
PreLoaderComponent,
PreloaderService,
} from './shared';
But I have encountered the following error.Similar to this error occurred in 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]
Upvotes: 0
Views: 6107
Reputation: 396
I resolved, this error occurs when we define a navcontroller
in component constructor
Which is not imported correctly.
In BodyComponent.ts:
import { GlobalRestService } from '../../../shared/services';
constructor(
private global: GlobalRestService,
private router: Router,
) {
....
....
}
'../../../shared/services' was not correct URL.
Upvotes: 4