0

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]
3
  • The provided code is insufficient to reproduce the issue Commented Jan 21, 2018 at 8:20
  • sometimes this issue will be because of missing import in app.modules.ts. check whether all the components, providers used in that page are imported in app modules. Commented Nov 17, 2018 at 13:08
  • Try stopping the project and run again. It helped me. Commented Feb 11, 2020 at 11:18

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.