This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

Meta

A service that can be used to get and add meta tags.

      
      class Meta {
  addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null
  addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]
  getTag(attrSelector: string): HTMLMetaElement | null
  getTags(attrSelector: string): HTMLMetaElement[]
  updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null
  removeTag(attrSelector: string): void
  removeTagElement(meta: HTMLMetaElement): void
}
    

Methods

addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null
      
      addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null
    

Parameters

tag

Type: MetaDefinition.

forceCreation

Type: boolean.

Optional. Default is false.

Returns

HTMLMetaElement | null

addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]
      
      addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]
    

Parameters

tags

Type: MetaDefinition[].

forceCreation

Type: boolean.

Optional. Default is false.

Returns

HTMLMetaElement[]

getTag(attrSelector: string): HTMLMetaElement | null
      
      getTag(attrSelector: string): HTMLMetaElement | null
    

Parameters

attrSelector

Type: string.

Returns

HTMLMetaElement | null

getTags(attrSelector: string): HTMLMetaElement[]
      
      getTags(attrSelector: string): HTMLMetaElement[]
    

Parameters

attrSelector

Type: string.

Returns

HTMLMetaElement[]

updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null
      
      updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null
    

Parameters

tag

Type: MetaDefinition.

selector

Type: string.

Optional. Default is undefined.

Returns

HTMLMetaElement | null

removeTag(attrSelector: string): void
      
      removeTag(attrSelector: string): void
    

Parameters

attrSelector

Type: string.

Returns

void

removeTagElement(meta: HTMLMetaElement): void
      
      removeTagElement(meta: HTMLMetaElement): void
    

Parameters

meta

Type: HTMLMetaElement.

Returns

void