Skip to content

Instantly share code, notes, and snippets.

@davismj
Created January 15, 2017 18:16
Show Gist options
  • Save davismj/9ed82edabc0d773c500731d4d3aae7c4 to your computer and use it in GitHub Desktop.
Save davismj/9ed82edabc0d773c500731d4d3aae7c4 to your computer and use it in GitHub Desktop.
import { inject, Aurelia, View } from 'aurelia-framework';
@inject(Aurelia, Element)
export class DFCustomElement {
constructor(aurelia, element) {
this.container = aurelia.container;
this.element = element;
}
attached() {
this.view = this.container.get(View);
}
removeMyself() {
this.element.remove();
this.view.detached();
this.view.unbind();
}
}
function enhanceFragment(targetElement) {
function proceed() {
let aurelia = window.DFAurelia;
let engine = aurelia.container.get(TemplatingEngine);
let view = engine.enhance({
container: aurelia.container,
element: targetElement,
resources: aurelia.resources
});
container.registerInstance(View, view);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment