mardi 10 février 2015

I'm using Ember App Kit with grunt and I'm trying to switch to Ember 1.10 and can't get HTMLBars working :/


TL;DR


After migration, I've got my HTMLBars templates lodaded in Ember.TEMPLATES but they're not visible either by Ember nor in App.__container.lookup.cache.


Details


The steps I did:



  • updated ember and ember-data

  • updated package.json ("grunt-ember-templates": "0.5.0")

  • updated my Gruntfile.js (grunt.loadNpmTasks('grunt-ember-templates') added a task emberTemplates)


  • passed the options to emberTemplates:



    {
    debug: "public/assets/templates.js",
    options: {
    templateCompilerPath: 'vendor/ember/ember-template-compiler.js',
    handlebarsPath: 'vendor/handlebars/handlebars.js',
    templateNamespace: 'HTMLBars'
    },
    'public/assets/templates.js': [
    'app/templates/**/*.hbs'
    ],
    };



  • removed handlebars.js from index.html and replaced ember.js with ember.debug.js




Now, I've got my public/assets/templates.js file generated in a proper way, I had several compilation errors coming from ember-template-compiler, so this part, I assume, is working fine.


Lastly, in the app, I can see all my templates loaded in Ember.TEMPLATES variable but unfortunately, they're not accessible from App.__container__.lookup.cache or App.__container__.lookup('template:<template_name>').


The way I'm trying to render the template that throws an error is (and it's working with Ember 1.9):



export default AuthRoute.extend({

renderTemplate: function() {
this.render();
this.render('user-details', {
into: 'base',
outlet: 'profile',
controller: 'user-details'
});
}
});


What am I missing? Any help would be appreciated.


Bonus question: what is debug field in emberTemplates configuration? If I don't define it, it raises an error, but I defined it in a random way. Could that be a possible reason?





Aucun commentaire:

Enregistrer un commentaire