mardi 7 février 2017

Compiling external HTML into ember understandable views

I am using ember 2.10.2 under linux environment. I am working on a visual editor task where I have to dynamically render html templates and let the user set styling and change the content etc.

When the route is loaded, I fetch the html string via AJAX call. That html string contains handlebars and action syntax as per ember standards. Now if I render the string as it is on View, it shows raw string considering handlebars as normal strings.

I want to compile the raw html string into ember understandable html so that I can render the view properly. I also used following method:

  layout: Ember.computed(function() {
return Ember.HTMLBars.compile(
  ' <span>' + 'hello' + '</span>'
);
}),

However , I get an object not an html string:

enter image description here

Please help me in getting the ember understandable HTML string so I can substitute properties in handlebars




Aucun commentaire:

Enregistrer un commentaire