我可以为 @HostBinding 装饰器添加什么参数?

What could I have like parameter to @HostBinding decorator?

找不到它的文档。

从示例中我得到了 3 个案例:

但是还有更多吗?

按照本文所写 link 由 Thierry Templier 创作,如果我没记错的话,他也活跃于该组 :) 图片来自该网站的 post。

propertyName: references a property of the host with the propertyName name.

@HostBinding('value') value:string;

attr.attributeName: references an attribute of the host with the attributeName name. The initial value is set to the associated directive property. Setting a value in the property updates the attribute on the corresponding HTML element. Using the null value at this level removes the attribute on the HTML element.

@HostBinding('attr.role') role:string;

style.styleName: links a directive property to a style of the HTML element.

@HostBinding('style.width.px') width:number;

class.className: links a directive property to a class name of the HTML element. If the value is true, the class is added otherwise removed.

@HostBinding('class.someClass') condition:boolean;