I'm totally new to Ember and I'm actually trying to organize my code a bit. To do so, I try to load my Handlebars templates from external files. Everything works fine until the moment I want to compile them.
var url = 'js/app/templates/index.hbs', templateName = url.replace('.hbs', ''),
datas = {name:'John'};
var load_tpl_success = function(hbs_tpl) {
Em.TEMPLATES[templateName] = Em.Handlebars.compile(hbs_tpl)(datas);
Em.$('body').append(Em.TEMPLATES[templateName]);
};
Em.$.ajax({ url: url, async: false, success: load_tpl_success});
This crashes and gives me te error : Uncaught TypeError: Cannot call method 'push' of undefined
BUT, if I use :
Handlebars.compile(hbs_tpl)(datas)
Everything works well until I start using {{input}} and others made by Ember. So basically it looks like Handlebars is working but not Ember... I need Ember ahah
I'm using the last version of Ember coming with its own Handlebars (old version).
Does anyone have an idea?