首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NGX-Cookieconsent在单击允许时不检索任何烹饪

NGX-Cookieconsent在单击允许时不检索任何烹饪
EN

Stack Overflow用户
提问于 2019-08-30 18:22:57
回答 1查看 1.4K关注 0票数 0

我正在尝试让允许Cookie按钮与ngx- Cookies连接,但无论何时我点击允许,hasConsented()仍然返回假,甚至在点击允许之后,当我刷新页面时弹出窗口总是显示。到目前为止,我已经尝试了info,选择加入或选择退出我的设置,但没有成功。

按钮字符串文本在i18n文件中。

代码语言:javascript
复制
this.statusChangeSubscription = this.ccService.statusChange$.subscribe((event: NgcStatusChangeEvent) => {
      // you can use this.ccService.getConfig() to do stuff...
      if (event.status === 'deny') {
        this.openCookies()
      }

      if (event.status === 'allow') {
        this.popupCloseSubscription = this.ccService.popupClose$.subscribe(() => {
          this.ccService.toggleRevokeButton(false)
        })
      }
    })
代码语言:javascript
复制
const cookieConfig: NgcCookieConsentConfig = {
  cookie: {
    domain: environment.domain,
  },
  position: 'bottom-left',
  theme: 'classic',
  palette: {
    popup: {
      background: '#000000',
      text: '#ffffff',
      link: '#ffffff',
    },
    button: {
      background: '#f9ae05',
      text: '#000000',
      border: '#f9ae05',
    },
  },
  type: 'opt-out',
  content: {
    href: environment.privacyUrl,
  },
}

当我刷新页面时,消息会再次打开。有什么帮助吗?

EN

回答 1

Stack Overflow用户

发布于 2019-11-29 16:15:00

这可能有点晚了,但我已经找到了来自ngx-cookieconsent创建者的答案:

https://github.com/tinesoft/ngx-cookieconsent/issues/4

更新'domain‘属性对我在项目中使用的一个angular应用程序有帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57724955

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档