Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackblitz demo does not work #69

Closed
mightymatth opened this issue Nov 18, 2019 · 4 comments
Closed

Stackblitz demo does not work #69

mightymatth opened this issue Nov 18, 2019 · 4 comments

Comments

@mightymatth
Copy link

mightymatth commented Nov 18, 2019

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)
@lorenzonet
Copy link

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

@adrienguyot
Copy link

same problem here

@tinesoft
Copy link
Owner

tinesoft commented Apr 3, 2020

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.

github-actions bot pushed a commit that referenced this issue Oct 8, 2022
# [3.0.0](v2.2.3...v3.0.0) (2022-10-08)

### Bug Fixes

* **core:** add `rel="noopener"` in html templates with `target="_blank"` ([4907c35](4907c35))
* add missing generic type to angular module ([7a44f3f](7a44f3f))
* **bundling:** missing external dependency 'rxjs/operators' ([baa7af8](baa7af8))
* **demo:** workaround for StackBlitz not supporting external scripts ([845af1a](845af1a)), closes [#69](#69)
* cookieconsent may be undefined ([290cac3](290cac3))

### Code Refactoring

* **core:** rename `initialize$` subscription into `initializing$` ([7233aa0](7233aa0))

### Features

* **config:** allow `whitelistPage`/  `blacklistPage` to accept RegExp[] ([8c95e6d](8c95e6d)), closes [#100](#100)
* **core:** add `initialized$` and `initializationError$` subscriptions ([a994f5e](a994f5e))
* **core:** improve `WindowService` to work on both browser and server ([cdb5e0a](cdb5e0a))
* **core:** loosen version of angular peerDependencies to v12 or higher ([ad9b4a2](ad9b4a2))
* **core:** migrate to Angular 12 and Nx workspace ([0d36a56](0d36a56))
* **core:** migrate to Angular 13 and Nx 13 ([c398496](c398496))

### BREAKING CHANGES

* **core:** `initialize$`  has been renamed to better reflect when this event is triggered

Use `initialized$` to get notify when the `cookieconsent` **has done** initializing successfully

***
[skip ci]
@github-actions
Copy link

github-actions bot commented Oct 8, 2022

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants