angular: ERROR in Error encountered resolving symbol values statically WITH functions exported.

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see

Current behavior Consider following module:

export function angularHttpFactory(backend: XHRBackend, defaultOptions: RequestOptions): Http {
  return new Http(backend, defaultOptions);

export function authHttpFactory(auth: Auth, backend: XHRBackend, defaultOptions: RequestOptions): AuthHttp {
  return new AuthHttp(auth, backend, defaultOptions);

  declarations: [LoginLoaderComponent],
  imports: [CommonModule, HttpModule, Ng2Webstorage],
  exports: [LoginLoaderComponent]
export class AuthModule {
  static forRoot(authConfig: AuthConfig): ModuleWithProviders {
    return {
      ngModule: AuthModule,
      providers: [
        { provide: AUTH_CONFIG, useValue: authConfig },
        { provide: ANGULAR_HTTP, useFactory: angularHttpFactory, deps: [XHRBackend, RequestOptions] },
        { provide: Http, useFactory: authHttpFactory , deps: [Auth, XHRBackend, RequestOptions] },

  static forChild(): ModuleWithProviders {
    return {
      ngModule: AuthModule

Following error occurs when importing npm package with above module definition: ERROR in Error encountered resolving symbol values statically. Calling function ‘AuthModule’, function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/Users/jacek_dauth3h/Documents/dev/action-center-web-app/src/app/app.module.ts, resolving symbol AppModule in C:/Users/jacek_dauth3h/Documents/dev/action-center-web-app/src/app/app.module.ts

Expected behavior No error.

  • Angular version: 2.4.3

  • Angular CLI version: 1.0.0-beta.24

  • Browser: all

  • Language: TypeScript 2.1.4

  • Node (for AoT issues): node --version = v6.9.4

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 33 (16 by maintainers)

Most upvoted comments

@mhevery angular-cli and ng-xi18n perform static analysis and produce errors. with cli even if you won’t enable aot (so afaiu triggers ngc) and ng-xi18n as well. I thought it’s optional process, but it seems like angular itself requires it by default. It would be nice to have option not to use it at all. e.g. for ng-xi18n just extract strings from html without super-per compilation…