HostAttributeToken
Создаёт токен, который можно использовать для внедрения статических атрибутов узла-хоста.
API
class HostAttributeToken {
constructor(attributeName: string): HostAttributeToken;
toString(): string;
}
constructor
HostAttributeToken
@paramattributeName
string
@returns
HostAttributeToken
toString
string
@returns
string
Примечания по использованию
Внедрение заведомо существующего атрибута
@Directive()
class MyDir {
attr: string = inject(new HostAttributeToken('some-attr'));
} Опциональное внедрение атрибута
@Directive()
class MyDir {
attr: string | null = inject(new HostAttributeToken('some-attr'), {optional: true});
}
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/core/HostAttributeToken