Instance accessors
Public
Tag.prototype.attributes
Tag.prototype.attributes
The get
accessor returns the tag attributes if set, otherwise undefined
.
public get attributes(): Attributes | undefined {
return this.#attributes;
}
Returns
The return value is a tag attributes of an Attributes
if set, or undefined
.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag [quote].
const tag = new Tag(`quote`, `<`, `>`, ['color', 'red']);
// Returns
Tag.prototype.closingTag
Tag.prototype.closingTag
The get
accessor gets the closing tag of a generic type ClosingTag
.
public get closingTag(): ClosingTag<Name, Opening, Closing> {
return `${this.#wrapper.opening}/${this.#name}${
this.#wrapper.closing
}`;
}
Returns
The return value is a tag closing of a generic type ClosingTag
.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag [quote].
const tag = new Tag(`quote`);
// Returns [/quote].
tag.closingTag;
Tag.prototype.name
Tag.prototype.name
The get
accessor gets the tag name without the wrap from the private property #name
.
public get name(): Name {
return this.#name;
}
Returns
The return value is a tag name of a generic type variables Name
.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag [quote].
const tag = new Tag(`quote`);
// Returns quote.
tag.name;
Tag.prototype.openingTag
Tag.prototype.openingTag
The get
accessor gets the opening tag with optional attributes.
public get openingTag(): OpeningTag<Name, Chars> {
return this.tag as OpeningTag<Name, Chars>;
}
Returns
The return value is an opening tag of a generic type OpeningTag
.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag <span color="red">.
const tag = new Tag(`span`, `<`, `>`, ['color', 'red']);
// Returns <span color="red">.
tag.openingTag;
Tag.prototype.tag
Tag.prototype.tag
The get
accessor gets the tag consists of the name, opening and closing of the wrap.
public get tag(): `${Opening}${Name}${Closing}` {
return `${this.#wrapper.opening}${this.#name}${
this.#wrapper.closing
}`;
}
Returns
The return value is a tag of a generic type variables in order Opening
, Name
and Closing
on the template.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag [quote].
const tag = new Tag(`quote`);
// Returns [quote].
tag.tag;
Tag.prototype.wrapper
Tag.prototype.wrapper
The get
accessor gets the wrapper.
ppublic get wrapper(): Wrapper<Opening, Closing> {
return this.#wrapper;
}
Returns
The return value is the Wrapper
instance.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag [quote].
const tag = new Tag(`quote`);
// Returns Wrapper {'[]'}.
tag.wrapper;
Tag.prototype.value
Tag.prototype.value
The get
accessor gets the tag without the attributes.
public get value(): string {
return this.valueOf();
}
Returns
The return value is the tag of a generic type variables in order Opening
, Name
and Closing
on the template.
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
// Create tag [quote].
const tag = new Tag(`quote`);
// Returns [quote].
tag.value;
[Symbol.toStringTag]
[Symbol.toStringTag]
The property, with the help of toStringTag
of Symbol, changes the default object tag to tag
for an instance of the Tag
.
public get [Symbol.toStringTag](): 'tag' {
return 'tag';
}
Example usage
// Example usage.
import { Tag } from '@angular-package/text';
import { typeOf } from '@angular-package/type';
// Define the tag.
const quoteTag = new Tag('quote');
// Returns 'tag'.
typeOf(quoteTag);
Last updated
Was this helpful?