lundi 9 février 2015

EmberJS call Handlebars Helper from component

Got a view > component structured application. In the 'controller' of the component, got the following code:



EmberApp.MyComponent = Ember.Component.extend({
...
someFunction: function(){
//here I must call 'myHelper'
},
...
});


And in other part of the script:



Ember.Handlebars.helper('myHelper', function(param1, param2){
//whatever it does
});


Ok, inside my HBS view file got the following:



{{myHelper aParam1 aParam2}}


It works partialy nice, that means that the helper works when view scope is loaded, but when I try to trigger the function, don't know how to call to the helper, so far I've tried:



Ember.Handlebars.helpers.myHelper.apply(this, {..params..});




Aucun commentaire:

Enregistrer un commentaire