HostAttributeToken
클래스
안정화
Creates a token that can be used to inject static attributes of the host node.
constructor
HostAttributeToken@paramattributeName
string@returns
HostAttributeTokentoString
string@returns
string사용 시 참고사항
Injecting an attribute that is known to exist
@Directive()
class MyDir {
attr: string = inject(new HostAttributeToken('some-attr'));
}
Optionally injecting an attribute
@Directive()
class MyDir {
attr: string | null = inject(new HostAttributeToken('some-attr'), {optional: true});
}
상세 내용으로 이동