aurelia-materialize-bridge
Version:
Aurelia interface to http://materializecss.com/
41 lines (32 loc) • 698 B
text/typescript
import * as au from "../aurelia";
.customAttribute("md-tooltip")
.autoinject
export class MdTooltip {
constructor(private element: Element) { }
.bindable
position: "top" | "right" | "bottom" | "left" = "bottom";
.bindable
delay: number = 50;
.bindable
html: string = "";
textChanged() {
this.initTooltip();
}
instance: M.Tooltip;
attached() {
this.initTooltip();
}
detached() {
if (this.instance) {
this.instance.destroy();
}
}
initTooltip() {
if (this.html) {
this.instance = new M.Tooltip(this.element, { exitDelay: this.delay, html: this.html, position: this.position });
}
else if (this.instance) {
this.instance.destroy();
}
}
}