aurelia-v-grid / vGrid

Aurelia-v-grid - npm source
MIT License
49 stars 10 forks source link

viewCompile in vNext #101

Closed vegarringdal closed 5 years ago

vegarringdal commented 6 years ago
const viewFactory = viewCompiler.compile(
    '<template><button click.trigger="testBtn()"></template>',
    viewResources);

const view = viewFactory.create(container);
const viewSlot = new ViewSlot(document.body, true);
viewSlot.add(this.view);

viewSlot.bind({testBtn:()=>{console.log('test')}, {
    bindingContext: {},
    parentOverrideContext: {}
});

viewSlot.attached();

bigopon showed me sample how to do similar gitter pasting it here to test out

const viewFactory = renderingEngine.getViewFactory({
  templateOrNode: '<template>...</template>',
  instructions: []
}, containerButExtendedTo__IRenderContext__NOT_needed__but_can_provide_to_overlay_on_root_container)
const view = viewFactory.create();

// instead of relying on ViewSlot to tell a view where to add / insert the nodes
// each NodeSequence knows how to handle that operation itself

view.$nodes.appendTo(document.body);
// or
view.$nodes.insertBefore(document.body.lastChild);

view.$bind(BindingFlags.fromBind /* or any extra flags you want using bitwise operator | */, { testButton: () => {}, })
vegarringdal commented 6 years ago

Its very similar to fkleuver pointed me to... the compose element