aurelia-materialize-bridge
Version:
Aurelia interface to http://materializecss.com/
32 lines (26 loc) • 652 B
text/typescript
import { bindable, customAttribute, autoinject } from "aurelia-framework";
import { MdSidenav } from "./sidenav";
export class MdSidenavCollapse {
constructor(private element: Element) { }
ref: MdSidenav;
attached() {
this.element.addEventListener("click", this.click);
if (this.ref) {
this.element.setAttribute("data-target", this.ref.controlId);
}
}
detached() {
this.element.removeEventListener("click", this.click);
}
click = () => {
if (this.ref.instance.isOpen) {
this.ref.close();
}
else {
this.ref.open();
}
}
}