From 524579ab16c847aa6b5491d6d207a3546aaf320f Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 2 Apr 2020 20:05:26 +0300 Subject: [PATCH] docs(core): add how dom strategies work --- docs/en/UI/Angular/Dom-Strategy.md | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 docs/en/UI/Angular/Dom-Strategy.md diff --git a/docs/en/UI/Angular/Dom-Strategy.md b/docs/en/UI/Angular/Dom-Strategy.md new file mode 100644 index 0000000000..eb4740bf0e --- /dev/null +++ b/docs/en/UI/Angular/Dom-Strategy.md @@ -0,0 +1,56 @@ +# 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(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](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) (_default: 'beforeend'_). + + +### insertElement(element: HTMLElement): void + +This method inserts given `element` to `target` based on the `position`. + + + + +## Predefined Dom Strategies + +Predefined dom strategies are accessible via `DOM_STRATEGY` constant. + + +### AppendToBody() + +`insertElement` will place the given `element` at the end of ``. + + +### AppendToHead() + +`insertElement` will place the given `element` at the end of ``. + + +### PrependToHead() + +`insertElement` will place the given `element` at the beginning of ``. + + +### AfterElement(target: HTMLElement) + +`insertElement` will place the given `element` after (as a sibling to) the `target`. + + +### BeforeElement(target: HTMLElement) + +`insertElement` will place the given `element` before (as a sibling to) the `target`. + + + + +## What's Next? + +- [LoadingStrategy](./Loading-Strategy.md)