tinesoft/ngx-cookieconsent

Stackblitz demo does not work

mightymatth opened this issue ยท 4 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report 
- [ ] feature request

In master branch (commit 43717bc):
https://stackblitz.com/github/tinesoft/ngx-cookieconsent/tree/master/demo
or
https://stackblitz.com/github/tinesoft/ngx-cookieconsent/tree/43717bc/demo

After opening, it asks to install missing packages (@nguniversal/commonngx-cookieconsent@angularclass/hmr). After installing, nothing happens, but there is an error in console:

ERROR TypeError: Cannot read property 'initialise' of undefined
    at NgcCookieConsentService.init (cookieconsent.service.ts:162)
    at new NgcCookieConsentService (cookieconsent.service.ts:119)
    at _createClass (ng_module.ts:176)
    at _createProviderInstance (ng_module.ts:144)
    at resolveNgModuleDep (ng_module.ts:106)
    at NgModuleRef_.get (refs.ts:507)
    at resolveDep (provider.ts:423)
    at createClass (provider.ts:283)
    at createDirectiveInstance (provider.ts:136)
    at createViewNodes (view.ts:303)

I've just set up the component in my application and I got the same error.
Angular 8.2.10
Angular/material 8.2.3

same problem here

It looks like Stackblitz does not (yet) support global scripts in the angular.json...
So the external dependency cookieconsent is no loaded, thus the undefined error.

This is on their radar and should land soon.
In the meantime, a workaround is to import the script in main.ts file:

...
  import 'cookieconsent';
...

I have updated the demo/main.ts file with that fix. It should be good now.

๐ŸŽ‰ This issue has been resolved in version 3.0.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€