Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Render template to string

$
0
0

@brayancastrop wrote:

I'm using ember 1.13.8 and now i need to setup a controller property that returns an object with a html property

Before 1.13.x i could use a View and maybe renderBuffers but now that's not an option as Views were deprecated

I'm using an addon (ember-c3 - https://github.com/Glavin001/ember-c3) which have an option to create custom tooltips by accepting an object with a key 'contents' and a HTML value, here is an example to illustrate the case

{{c3-chart data=data tooltip=tooltip }}

and the controller tooltip property

tooltip: Ember.computed('model', function() {
  return {
    contents: function (d, defaultTitleFormat, defaultValueFormat, color) {
        return ...; // here is where i need to compile a template to a string
    }
  };
})

i noticed i can access a template object by calling container.lookup('template:path') but it's an object like this

{
  arity: 0
  isMethod: false
  isTop: true
  meta: Object
  raw: Object
  render: (self, env, options, blockArguments)
}

but have no idea how to use it in the case it's useful

Any guidance will be appreciated, thanks in advance :smiley:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles