2

我正在使用 ngx-cookieconsent,它按预期工作,除了 initialize$ 回调函数。

this.initializeSubscription = this.cookieConsentService.initialize$.subscribe(
      (event: NgcInitializeEvent) => {
        console.log('cookie config ',this.cookieConsentService.getConfig());
      });

尽管显示了 cookie 同意弹出窗口,但似乎从未调用过初始化。没有错误,但在打印其他日志记录时,日志永远不会打印到控制台。

这是我的配置(虽然我不认为它是相关的)

const cookieConfig:NgcCookieConsentConfig = {
  enabled: true,
  cookie: {
    domain: environment.domain
  },
  "palette": {
    "popup": {
      "background": "#237afc"
    },
    "button": {
      "background": "#fff",
      "text": "#237afc"
    }
  },
  theme: 'block',
  type: 'info'
};

我在这里想念什么?

4

0 回答 0