Refresh bindings


#1

Can someone tell me how to force Aurelia to refresh bindings? When using Durandal/Knockout, I did this:

var body = this.element.find("tbody")[0];
if (body) {
    ko.cleanNode(body);
    ko.applyBindings(ko.dataFor(body), body);
}

What is the equivalent in Aurelia?

More details on my case here: https://stackoverflow.com/questions/50022746/how-to-refresh-bindings


#2

Problem was solved using TemplatingEngine.enhance as follows:

import { TemplatingEngine } from 'aurelia-templating';

Inject an instance of TemplatingEngine:
@inject(TemplatingEngine)

Constructor:

constructor(templatingEngine) {
    this.templatingEngine = templatingEngine;
}

Main Code:

let self = this;
// etc...

var body = $('#grid').find('tbody')[0];
if (body) {
    self.templatingEngine.enhance({ element: body, bindingContext: self });
}

#3

You could also you signal behavior