2

如何删除小的“Cookie 政策”窗口?我正在使用最新版本的 ngx-cookieconsent 和 Angular 7.2

在此处输入图像描述

4

3 回答 3

1

我被迫关闭它:
this.ccService.close(false);
或隐藏this.ccService.fadeOut();

因为'revokable': false选项不起作用。

于 2020-07-28T18:00:55.630 回答
0

你试过this.ccService.getConfig().autoOpen=false吗?保存cookie后,我将其设置为false。

于 2019-04-18T13:32:12.967 回答
0

我这个答案有点晚了,但今天遇到了同样的问题,我找到了一些解决方法。

this.statusChangeSubscription = this.ccService.statusChange$.subscribe(
  (event: NgcStatusChangeEvent) => {
    if (event.status === 'allow') {
      this.ccService.close(false); // Hide revoke button after accepting cookies
    }        
  });

在此下方或末尾ngOnInit()我添加了以下内容:

if (this.ccService.hasConsented()) {
  this.ccService.destroy();      
}

上面的代码检查您是否获得同意,如果是,它将破坏弹出实例。

于 2021-03-02T13:04:38.300 回答