ngx-bootstrap
Version:
Native Angular Bootstrap Components
26 lines • 979 B
JavaScript
import { Injectable, ElementRef } from '@angular/core';
import { positionElements } from './ng-positioning';
var PositioningService = /** @class */ (function () {
function PositioningService() {
}
PositioningService.prototype.position = function (options) {
var element = options.element, target = options.target, attachment = options.attachment, appendToBody = options.appendToBody;
positionElements(_getHtmlElement(target), _getHtmlElement(element), attachment, appendToBody);
};
PositioningService.decorators = [
{ type: Injectable },
];
return PositioningService;
}());
export { PositioningService };
function _getHtmlElement(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;
}
//# sourceMappingURL=positioning.service.js.map