salemdar / angular2-cookie

Implementation of Angular 1.x $cookies service to Angular 2
MIT License
109 stars 29 forks source link

AoT compilation fails because of CookieOptions #19

Closed DirkWillem closed 8 years ago

DirkWillem commented 8 years ago

When I try to compile an angular 2 application with CookieService using the AoT compiler, it doesn't compile because of the following error:

..../app.module.ngfactory.ts(436,82): error TS2346: Supplied parameters do not match any signature of call target.

When I take a look at that line, it looks like this:

if ((this.__CookieService_54 == (null as any))) { (this.__CookieService_54 = new import36.CookieService(); }

According to IntelliSense, the CookieService takes one required argument named defaultOptions, but it isn't provided by the compiled code. In my NgModule, I provide CookieService like this:

@NgModule({
    imports: [
        BrowserModule,
        SharedModule,
        FormsModule,
        routing
    ],
    declarations: [
        AppComponent,
        ...frameworkComponents,
        ...viewComponents,
        LoginComponent],
    providers: [
        appRoutingProviders,
        CookieService
    ],
    bootstrap: [AppComponent]
})
salemdar commented 8 years ago

Thank you for the detailed report, I will inspect this as soon as possible.

DirkWillem commented 8 years ago

Solved by #20