Closed
Description
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Mac El Capitan - Versions.
angular-cli: 1.0.0-beta.5
node: 5.11.1
os: darwin x64
- 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.
- 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.