docs/en/framework/ui/angular/dom-strategy.md
//[doc-seo]
{
"Description": "Explore the `DomStrategy` class in the @abp/ng.core package, which defines how elements attach to the DOM, enhancing your development workflow."
}
DomStrategy is a class exposed by @abp/ng.core package. Its instances define how an element will be attached to the DOM and are consumed by other classes such as LoadingStrategy.
constructor(
public target?: HTMLElement,
public position?: InsertPosition
)
target is an HTMLElement (default: document.head).position defines where the created element will be placed. All possible values of position can be found here (default: 'beforeend').insertElement(element: HTMLElement): void
This method inserts given element to target based on the position.
Predefined dom strategies are accessible via DOM_STRATEGY constant.
DOM_STRATEGY.AppendToBody()
insertElement will place the given element at the end of <body>.
DOM_STRATEGY.AppendToHead()
insertElement will place the given element at the end of <head>.
DOM_STRATEGY.PrependToHead()
insertElement will place the given element at the beginning of <head>.
DOM_STRATEGY.AfterElement(target: HTMLElement)
insertElement will place the given element after (as a sibling to) the target.
DOM_STRATEGY.BeforeElement(target: HTMLElement)
insertElement will place the given element before (as a sibling to) the target.