1 | import { Injectable, ElementRef } from '@angular/core';
|
2 | import { positionElements } from './ng-positioning';
|
3 | export var PositioningService = (function () {
|
4 | function PositioningService() {
|
5 | }
|
6 | PositioningService.prototype.position = function (options) {
|
7 | var element = options.element, target = options.target, attachment = options.attachment, appendToBody = options.appendToBody;
|
8 | positionElements(this._getHtmlElement(target), this._getHtmlElement(element), attachment, appendToBody);
|
9 | };
|
10 | PositioningService.prototype._getHtmlElement = function (element) {
|
11 |
|
12 | if (typeof element === 'string') {
|
13 | return document.querySelector(element);
|
14 | }
|
15 | if (element instanceof ElementRef) {
|
16 | return element.nativeElement;
|
17 | }
|
18 | return element;
|
19 | };
|
20 | PositioningService.decorators = [
|
21 | { type: Injectable },
|
22 | ];
|
23 |
|
24 | PositioningService.ctorParameters = function () { return []; };
|
25 | return PositioningService;
|
26 | }());
|
27 |
|
\ | No newline at end of file |