UNPKG

1.11 kBJavaScriptView Raw
1import { Injectable, ElementRef } from '@angular/core';
2import { positionElements } from './ng-positioning';
3export 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 // it means that we got a selector
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 /** @nocollapse */
24 PositioningService.ctorParameters = function () { return []; };
25 return PositioningService;
26}());
27//# sourceMappingURL=positioning.service.js.map
\No newline at end of file