ng2-bootstrap
Version:
Native Angular Bootstrap Components
27 lines • 1.11 kB
JavaScript
import { Injectable, ElementRef } from '@angular/core';
import { positionElements } from './ng-positioning';
export var PositioningService = (function () {
function PositioningService() {
}
PositioningService.prototype.position = function (options) {
var element = options.element, target = options.target, attachment = options.attachment, appendToBody = options.appendToBody;
positionElements(this._getHtmlElement(target), this._getHtmlElement(element), attachment, appendToBody);
};
PositioningService.prototype._getHtmlElement = function (element) {
// it means that we got a selector
if (typeof element === 'string') {
return document.querySelector(element);
}
if (element instanceof ElementRef) {
return element.nativeElement;
}
return element;
};
PositioningService.decorators = [
{ type: Injectable },
];
/** @nocollapse */
PositioningService.ctorParameters = function () { return []; };
return PositioningService;
}());
//# sourceMappingURL=positioning.service.js.map