我实现了这样的 @HostBinding 装饰器:
@HostBinding('class.open')
opened: boolean;
我在打开功能中更改了布尔值:
public open(): void {
this.opened = true;
}
类已添加到所有浏览器的组件中,但未在 IE 中添加类!
另一方面,this.renderer.addClass(this.elementRef.nativeElement, 'open')
可以正常工作,但我更喜欢使用@HostBinding!
请帮助我