I have a property in my controller and i want to pass this property to my custom handlebar helper
App.AppController = Ember.Controller.extend({
json: //this property contain some string
});
and my helper is like this :
Handlebars.registerHelper('NGRID', function(json) {
console.log('im calling in ngrid');
});
and my view is something like this :
<script type="text/x-handlebars" data-template-name="table">
{{!-- Table here --}}
{{NGRID json}}
</script>
but {{NGRID json}}
pass string json
to handlebars helper and i need to pass content of json peroperty .
Ember has its own template mechanism. You need to use registerBoundHelper for passing object
Ember.Handlebars.registerBoundHelper('NGRID', function(json, options){
console.log('NGRID json:' + json);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.