ng2-materialize
Version:
An Angular 2+ wrap around Materialize library
54 lines (53 loc) • 1.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var MzTooltipDirective = (function () {
function MzTooltipDirective(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
}
MzTooltipDirective.prototype.ngOnInit = function () {
this.initElements();
};
MzTooltipDirective.prototype.ngAfterViewInit = function () {
this.initTooltip();
};
MzTooltipDirective.prototype.ngOnChanges = function (changes) {
if (this.targetElement) {
this.initTooltip();
}
};
MzTooltipDirective.prototype.ngOnDestroy = function () {
this.renderer.invokeElementMethod(this.targetElement, 'tooltip', ['remove']);
};
MzTooltipDirective.prototype.initElements = function () {
this.targetElement = $(this.elementRef.nativeElement);
};
MzTooltipDirective.prototype.initTooltip = function () {
var tooltipOptions = {
delay: isNaN(this.delay) || this.delay == null ? 350 : this.delay,
html: this.html || false,
position: this.position || 'bottom',
tooltip: this.tooltip,
};
this.renderer.invokeElementMethod(this.targetElement, 'tooltip', [tooltipOptions]);
};
return MzTooltipDirective;
}());
MzTooltipDirective.decorators = [
{ type: core_1.Directive, args: [{
selector: '[mzTooltip], [mz-tooltip]',
},] },
];
/** @nocollapse */
MzTooltipDirective.ctorParameters = function () { return [
{ type: core_1.ElementRef, },
{ type: core_1.Renderer, },
]; };
MzTooltipDirective.propDecorators = {
'delay': [{ type: core_1.Input },],
'html': [{ type: core_1.Input },],
'position': [{ type: core_1.Input },],
'tooltip': [{ type: core_1.Input },],
};
exports.MzTooltipDirective = MzTooltipDirective;