Angular 如何以编程方式打开/关闭ngx cookie同意弹出窗口?

Angular 如何以编程方式打开/关闭ngx cookie同意弹出窗口?,angular,typescript,events,cookieconsent,Angular,Typescript,Events,Cookieconsent,我用的是角形的。 我想找到一种以编程方式显示/隐藏弹出窗口的方法 我尝试通过NgcCookieConsentService的实例访问方法close,但没有成功 我们的想法是建立这样一个链接: html: 在构造函数中,可以声明NgcCookieConsentService类的实例: private ccService: NgcCookieConsentService 然后在您的函数中,您可以调用open函数来重新打开cookie弹出窗口 this.ccService.open(); 我找到的

我用的是角形的。 我想找到一种以编程方式显示/隐藏弹出窗口的方法

我尝试通过
NgcCookieConsentService
的实例访问方法
close
,但没有成功

我们的想法是建立这样一个链接:

html:


在构造函数中,可以声明NgcCookieConsentService类的实例:

private ccService: NgcCookieConsentService
然后在您的函数中,您可以调用open函数来重新打开cookie弹出窗口

this.ccService.open();

我找到的方法是从NgcCookieConsentService实例调用函数
fadeIn()
fadeOut()
。感谢你让我回顾这个问题

所以在
.ts

...
constructor(private ccService: NgcCookieConsentService){}
...
opencc(){
    this.ccService.fadeIn();
    //fadeOut to hide
}
然后在htlm中

<div (click)="opencc()">
    ...
</div

...

您回答的问题是,当使用
open
close
时,此初始化或完全关闭cookie的最佳方法是使用
fadeIn
fadeOut
。无论如何谢谢你
...
constructor(private ccService: NgcCookieConsentService){}
...
opencc(){
    this.ccService.fadeIn();
    //fadeOut to hide
}
<div (click)="opencc()">
    ...
</div