First of all, I must say that my app works fine when "using" JIT. I can even bundle in prod (no AOT, just JIT) and it works fine.
But when I try to compile it (AOT) using ngc
I am getting an error, which says:
Can't resolve all parameters for MyComponentView in /path/my-component/my-component.view.ts:
([object Object], [object Object], [object Object], [object Object], ?)
This is the constructor of MyComponent
:
constructor( headerService:HeaderService, sidebarService:SidebarService, @Inject( AuthService.Token ) authService:AuthService.Class, router:Router, carbon:Carbon ) {
…
this.carbon = carbon;
…
}
The last dependency (Carbon) is being provided in AppModule like this:
@NgModule( {
imports: [
…
],
declarations: [
…
],
providers: [
…
CARBON_PROVIDERS, //<---- HERE IS BEING PROVIDED
CARBON_SERVICES_PROVIDERS,
…
],
bootstrap: [ AppComponent ],
} )
export class AppModule { }
The CARBON_PROVIDERS
are being imported using the angular2-carbonldp project which is exporting them like this:
export const CARBON_PROVIDERS:any[] = [
{
provide: Carbon,
useFactory(): Context {
return carbon;
},
},
{
provide: ContextToken,
useFactory(): Context {
return activeContextFn();
},
},
{
provide: App.Context,
useFactory(): App.Context {
if( ! activeContextFn.isAppContext() ) throw new Errors.IllegalStateError( "The activeContext is not an App Context" );
return <any>activeContextFn();
},
},
];
But I end up having the same error and I don't understand WHY! Do you guys happen to know why is it working like that?