salemdar / angular2-cookie

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

EXCEPTION: No provider for CookieOptions! #51

Open stevermeister opened 7 years ago

stevermeister commented 7 years ago

For AOT compilation I'm getting such error. screen shot 2017-02-28 at 15 02 26

sebastianhaas commented 7 years ago

I've tried to fix this for myself, feel free to take a look here: https://github.com/sebastianhaas/angular2-cookie/tree/fix-aot-compile

I added a CookieModule which you can import in your module. It will provide the CookieService. If you want to try, run npm run build && npm pack on my branch and install from there.

However, I don't have much experience with gulp nor time to figure out the rather complex setup of this project to prepare it as a PR atm :(

stevermeister commented 7 years ago

@sebastianhaas thank you, you helped me a lot with link to same issue.

I've implemented this approach:

export function cookieServiceFactory(): CookieService {
  return new CookieService();
}

I still would be nice to have solution for box.

salemdar commented 7 years ago

It will be in the next version, which I plan to release this weekend.

rgajam commented 7 years ago

@salemdar I really appreciate if you could fix this sooner.

sebastianhaas commented 7 years ago

You may want to check out salemdar/ngx-cookie.

rgajam commented 7 years ago

Thanks @sebastianhaas! salemdar/ngx-cookie solved the problem.

pinalbhatt commented 7 years ago

@salemdar @sebastianhaas does this mean that 'ngx-cookie' will be supported in future and we can move from 'angular2-cookie' to 'ngx-cookie'? (indicating 'angular2-cookie' is dead )

e2murali commented 7 years ago

I am using 'ngx-cookie' instead of 'angular2-cookie' and i get same error.

richh94 commented 7 years ago

I have this error when testing with Karma/Jasmine.

MartinMuzatko commented 7 years ago

Typescript Error

Module '"node_modules/angular2-cookie/services/cookie-options-args.model"' has no exported member 'CookieOptions'.