Created
January 15, 2017 18:16
-
-
Save davismj/9ed82edabc0d773c500731d4d3aae7c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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