Meta
class
A service for managing HTML <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
}
See also
Provided in
'root'
Description
Properties of the MetaDefinition
object match the attributes of the HTML <meta>
tag. These tags define document metadata that is important for things like configuring a Content Security Policy, defining browser compatibility and security settings, setting HTTP Headers, defining rich content for social sharing, and Search Engine Optimization (SEO).
To identify specific <meta>
tags in a document, use an attribute selection string in the format "tag_attribute='value string'"
. For example, an attrSelector
value of "name='description'"
matches a tag whose name
attribute has the value "description"
. Selectors are used with the querySelector()
Document method, in the format meta[{attrSelector}]
.
Methods
addTag() | ||||||
---|---|---|---|---|---|---|
Retrieves or creates a specific <meta> tag element in the current HTML document. In searching for an existing tag, Angular attempts to match the name or property attribute values in the provided tag definition, and verifies that all other attribute values are equal. If an existing element is found, it is returned and is not modified in any way.
| ||||||
addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | nullParameters
Returns
|
| ||||||
---|---|---|---|---|---|---|
Retrieves or creates a set of <meta> tag elements in the current HTML document. In searching for an existing tag, Angular attempts to match the name or property attribute values in the provided tag definition, and verifies that all other attribute values are equal.
| ||||||
addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]Parameters
Returns
|
getTag() | |||
---|---|---|---|
Retrieves a <meta> tag element in the current HTML document.
| |||
getTag(attrSelector: string): HTMLMetaElement | nullParameters
Returns
|
| |||
---|---|---|---|
Retrieves a set of <meta> tag elements in the current HTML document.
| |||
getTags(attrSelector: string): HTMLMetaElement[]Parameters
Returns
|
updateTag() | ||||||
---|---|---|---|---|---|---|
Modifies an existing <meta> tag element in the current HTML document.
| ||||||
updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | nullParameters
Returns
|
removeTag() | |||
---|---|---|---|
Removes an existing <meta> tag element from the current HTML document.
| |||
removeTag(attrSelector: string): voidParameters
Returns
|
removeTagElement() | |||
---|---|---|---|
Removes an existing <meta> tag element from the current HTML document.
| |||
removeTagElement(meta: HTMLMetaElement): voidParameters
Returns
|
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/platform-browser/Meta