Ember Custom Templates

I’m trying to do some reporting with ember but I need to have customizable template for each report. I’d like to have a report model with its template and then render the view with the model.template attribute.

Does someone know how to acheive that with ember?

Thanks :smile:

I don’t know the details but this maybe enough to get you on the right path.

I believe that you can go about this by compiling the template string using htmlbars.

Then you can register it in Ember.TEMPLATES OR you can override the template resolver to look up certain template names. http://emberjs.com/api/classes/Ember.DefaultResolver.html

hope that is of some use!

Thanks !

It worked !! This is how my router looks like:

renderTemplate: function() {
      var templateName = this.get('controller.model').get('templateName');
      var template = this.get('controller.model').get('template');
      Ember.TEMPLATES[templateName] = Ember.Handlebars.template(Ember.Handlebars.precompile(template));
      this.render(templateName);
}