DomStrategy

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.

API

constructor

constructor(
  public target?: HTMLElement,
  public position?: InsertPosition
)
JavaScript
  • 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

insertElement(element: HTMLElement): void
JavaScript

This method inserts given element to target based on the position.

Predefined Dom Strategies

Predefined dom strategies are accessible via DOM_STRATEGY constant.

AppendToBody

DOM_STRATEGY.AppendToBody()
JavaScript

insertElement will place the given element at the end of <body>.

AppendToHead

DOM_STRATEGY.AppendToHead()
JavaScript

insertElement will place the given element at the end of <head>.

PrependToHead

DOM_STRATEGY.PrependToHead()
JavaScript

insertElement will place the given element at the beginning of <head>.

AfterElement

DOM_STRATEGY.AfterElement(target: HTMLElement)
JavaScript

insertElement will place the given element after (as a sibling to) the target.

BeforeElement

DOM_STRATEGY.BeforeElement(target: HTMLElement)
JavaScript

insertElement will place the given element before (as a sibling to) the target.

See Also

Contributors


Last updated: July 31, 2024 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

Community Talks

Deep Dive #1: Identity&Account Modules

17 Apr, 17:00
Online
Watch the Event
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book