tinesoft / ngx-cookieconsent

Cookie :cookie: Consent module for Angular.
https://tinesoft.github.io/ngx-cookieconsent/
MIT License
163 stars 35 forks source link

cookie consent doesn't close on static site #93

Closed tiberiu-bucovei closed 3 years ago

tiberiu-bucovei commented 3 years ago

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

CookieConsent and Library Versions?

- cookieconsent version: 3.1.1
- ngx-cookieconsent version:2.2.3

OS Version?

Windows 10

Angular, Node and al Versions?

Angular CLI: 9.1.6 Node: 12.18.4 OS: win32 x64

Repro steps

Using scully.io to generate static files from angular project the cookieconsent dialog opens but it doesn't close on user action on the I agree button. There are no errors in the console either. On SPA it's working as it should. Here is the configuration I've used in the app.module.ts const cookieConfig: NgcCookieConsentConfig = { cookie: { domain: 'localhost' }, palette: { popup: { background: '#007bff' }, button: { background: '#6f90ee' } }, position: "bottom-right", theme: 'edgeless', type: 'info', content: { message: "Cookie consent text ", dismiss: "I agree!", deny: "Refuse cookies", link: "More information", href: "/gdpr", policy: "Cookie Policy" } };

The log given by the failure

Desired functionality

Would like to have the same functionality working on static generated files.

Mention any other details that might be useful

kishorejangid commented 3 years ago

Did you got his working? I am facing same issue with scully.

qwyk commented 3 years ago

@btibia @kishorejangid

Try adding this to your config:

import { isScullyRunning } from '@scullyio/ng-lib';

const cookieConsentConfig: NgcCookieConsentConfig = {
    ...
    enabled: !isScullyRunning()
}

See: https://scully.io/docs/Reference/ngLib/utility-methods/

tinesoft commented 3 years ago

Closed because of lack of recent activity. Feel free to re-open with additional context, if this is still an issue.