Creating elements in Aurelia -
i'm trying create aurelia element inside of element. i'm using docking framework phosphor , when dynamically create panel want add component i've build using aurelia.
for example: have simple logging component:
logging.html
<template> <h1>logging....</h1> </template>
logging.ts:
export class logging { constructor() { console.log('logging constructor') } }
the component works expected when "just put on page".
now inside of method creates phosphor widget have this:
var widget = new widget(); widget.title = "got logs?"; var contentelement = document.createelement('logging'); widget.node.appendchild(contentelement); panel.insertbottom(widget);
this code, given phosphor panel, creates widget, creates element looks like: <logging></logging>
, appends widget's inner node. resulting "dom" correct aurelia not render element.
i have tried using templatingengine so:
import { inject, templatingengine } 'aurelia-framework'; @inject(templatingengine) export class aureliaroot { constructor(templatingengine) { } attached() { var contentelement = document.createelement("logging"), el = document.getelementbyid("my-element"); el.appendchild(contentelement); templatingengine.enhance({element: el, bindingcontext: {}}); } }
but doesn't seem work, although doubt i'm using right , think might need use compile
, not sure there.
any insights appreciated.
i'm sorry won't able answer fully, believe need use aurelia viewcompiler compile fragments of html generated parsed aurelia.
try looking @ following link more information: how use viewcompiler manually compile part of dom?
Comments
Post a Comment