samedi 21 mars 2015

How to create ember handlebar helper?

Hy to all


I try to create helper



Handlebars.registerHelper('testCan', function(permissionName, options){
var permission = Ember.Object.extend({
testCan: function(){
debugger;
return true;
}.property()
});

// wipe out contexts so boundIf uses `this` (the permission) as the context
options.contexts = null;

Ember.Handlebars.helpers.boundIf.call(permission, "testCan", options)
});


And use it as



{{#testCan read controller=controller}}
<h1>It's works</h1>
{{/testCan}}


I do this to test pattern from here http://ift.tt/1Fk8XdU


But it doesn't work ((


What's wrong? Ember version - 1.9.1





Aucun commentaire:

Enregistrer un commentaire