salemdar / angular2-cookie

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

RC5 Webpack ES6 can't find providers. #17

Closed zaikin-andrew closed 8 years ago

zaikin-andrew commented 8 years ago

Hi there. I have a build with webpack(with Babel) and project with ng2 rc5 written by ES6. I'm trying to add CookieService to providers in AppModule

import { CookieService } from 'angular2-cookie/core';

...
providers: [CookieService]
...

but have an error

Error: Uncaught (in promise): No provider for CookieOptions!

CookieOptions is not injectable as I understand. Well I'm trying to use ANGULAR2_COOKIE_PROVIDERS

import { ANGULAR2_COOKIE_PROVIDERS } from 'angular2-cookie/core';

...
providers: [ANGULAR2_COOKIE_PROVIDERS]
...

but have

Error: Uncaught (in promise): No provider for String!

Could you assist me please?

salemdar commented 8 years ago

Hey Andrew, I must admit that I have never used angular 2 with es6. I must experiment a little bit. Is there any reason for not using TS?

zaikin-andrew commented 8 years ago

The reason is the decision of the our client xD

salemdar commented 8 years ago

How unfortunate for you :) How do you import js files? SystemJS, webpack, jspm?

zaikin-andrew commented 8 years ago

I used https://github.com/blacksonic/angular2-babel-esnext-starter as a starter kit with webpack.

zaikin-andrew commented 8 years ago

I tried to use fresh clone of the repo https://github.com/blacksonic/angular2-babel-esnext-starter and everything is ok :smiley: Probably I need to update my build to RC6 according angular2-babel-esnext-starter.

Sorry to bother you.

salemdar commented 8 years ago

No problem :)

JonnyBGod commented 8 years ago

I am also getting this error.

Angular 2.1.0-beta.0 Webpack 2.1.0.beta.22

following instructions in readme.md