ember.js - Dynamic nature of templates broken by custom handlebars helper -
i have helper function:
// can insert straight html controller, doing: // {{rawhtml formattedname}} // formattedname name of controller property returning html handlebars.registerhelper('rawhtml', function(propname) { var html = this.get(propname); if(typeof html === 'undefined') { console.error('rawhtml > propname=%s can not found. using empty string html', propname); html = ''; } homecoming new handlebars.safestring(html); });
which utilize way in template:
<td>{{#link-to controller.showroute this}}{{rawhtml formattedname}}{{/link-to}}</td>
formattedname
computed property:
settingsapp.genericmodel = ds.model.extend({ 'properties§name' : ds.attr('string'), formattedname: function () { var formattedname = this.get('properties§name') || settingsapp.helpers.marktext(config.lang.undefined_name, 'undef'); homecoming formattedname; }.property('properties§name'), ... });
this working fine. there problem: whenever info in store changes while template beingness displayed (no route change), template not update. in application happens whenever info beingness pushed server (websockets) or whenever trigger manual / automatic store update (for testing) without changing routes.
i have narrowed problem rawhtml
helper: if following:
<td>{{#link-to controller.showroute this}}{{formattedname}}{{/link-to}}</td>
the template gets updated all-right. so, store working fine , computed property working fine.
i know problem in rawhtml
helper? kind of update chain breaking? how can prepare not break dynamic nature of templates?
according guide:
if name property on current context changes, ember.js automatically execute helper 1 time again , update dom new value.
but not seem case: formattedname
changes, helper not called. doing wrong?
according docs (http://emberjs.com/api/classes/ember.handlebars.html#method_registerboundhelper) should using ember.handlebars.registerboundhelper
info binding. registerhelper
default unbound.
ember.js handlebars.js
No comments:
Post a Comment