Skip to content

ng build -prod app stuck on loading screen #1034

Closed
@CristyTarantino

Description

@CristyTarantino
  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Mac El Capitan
  2. Versions.
angular-cli: 1.0.0-beta.5
node: 5.11.1
os: darwin x64
  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.

I have a component and in the file I do:

import { chartViewProvider } from '../shared/chartview.service';
@Component({
  ...,
  providers: [
    chartViewProvider
  ]
})

in chartview.service file

export let chartViewFactory = (service: IResearchService, obj: any): any => {
    ... return new object
  }
};

export let chartViewProvider = provide(CHARTVIEW, {
  useFactory: () => chartViewFactory
});

Where CHARTVIEW and ChartView are:

import { OpaqueToken } from '@angular/core';
import { IResearchService } from './research.service.interface';

export let CHARTVIEW = new OpaqueToken('ChartView');

export interface ChartView {
  id: number | string;
  name: string;
  render(region: string, fromdate: string, todate: string, xCategories?: Array<string>): void;
}

Basically trying to use https://angular.io/docs/ts/latest/guide/dependency-injection.html guide for factory provider.

If I do ng serve the app works perfectly.
If I do ng serve -prod the app shows the loading screen and it never loads.
If I comment out

 providers: [
   // chartViewProvider
  ]

and then ng serve -prod the app works fine.

  1. The log given by the failure. Normally this include a stack trace and some
    more information.

There is literally no error message either in the terminal or in the console.

Thanks for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfultype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions