Manually rendering a view


#1

Hi, I need to manually render a template and pass the result html string to a 3rd party library. I tried the following:

App.TooltipView = Ember.View.extend
  template: Ember.TEMPLATES['tooltip']

and then

view = App.TooltipView.create()
buffer = Ember.RenderBuffer('div')
view.render(buffer)
buffer.string()

it didn’t work. I get an error message: Uncaught You can’t use appendChild outside of the rendering process

what is the correct why to do this?


#2

I do it this way from a component. Note this won’t work in 1.8.0.

      view = App.TooltipView.create()
      view.container = @get('targetObject.container')
      buffer = Ember.RenderBuffer()
      view.renderToBuffer(buffer)
      html = buffer.string()