• Overview
@angular/core

HOST_TAG_NAME

constant
stable

A token that can be used to inject the tag name of the host node.

API

    
      const HOST_TAG_NAME: InjectionToken<string>;
    
    

Usage Notes

Injecting a tag name that is known to exist

@Directive()
class MyDir {
  tagName: string = inject(HOST_TAG_NAME);
}

Optionally injecting a tag name

@Directive()
class MyDir {
  tagName: string | null = inject(HOST_TAG_NAME, {optional: true});
}
Jump to details