Closed sod closed 7 years ago
Add CookieService to be used in dependency injection in angular
CookieService
import {CookieService} from 'ng2-cookies'; @Component({ providers: [CookieService] }) class MyComponent { constructor(cookie: CookieService) { cookie.get('foo'); } }
So you are able to mock it in unit tests.
Old export still works so this PR doesn't break existing users workflow.
import {Cookie} from 'ng2-cookies'; Cookie.get('foo');
Very nice approach.
@carcamano It's good to go to me!
I still can't inject this during unit tests. Are you sure you don't need to apply the @Injectable decorator to the CookieService class?
Add
CookieService
to be used in dependency injection in angularSo you are able to mock it in unit tests.
Old export still works so this PR doesn't break existing users workflow.