googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 61 forks source link

Updating template when model's child property changes not working #195

Open binoculars opened 9 years ago

binoculars commented 9 years ago

Is there a better or proper way than to set template.model = template.model to trigger the observer?

Example

var template = document.querySelector('#mytemplate');
template.bindingDelegate = new PolymerExpressions();
template.model = {};

['child1', 'child2'].map(function(child) {
    document.querySelector('core-ajax.' + child).addEventListener("core-response",
        function (e) {
            template.model[child] = e.detail.response;
            template.model = template.model; // workaround for now.
        }
    );
});