Can we bind to an Ember action after render of unbound structure?


#1

Looking for direction, fairly new to Ember 2.x. We are currently using a custom json string to draw an SVG navigation tree in our application. Since the string did not fit into ember json standards we just use emmber.getjson to return the string and fire the tree drawing method inside an ember component. Simple and done.

However now we are trying to figure out how to bind the rectangles onclick event to the ember popup dialogue after its done. Failing miserably because we really just cannot figure out how we might bind the onclick after, since the shapes are not known until the tree has been drawn. Did we completely do this the wrong way?


#2

You cannot bind action to existing dom. Actually you should not even touch the dom inside a component. From there, you have two options:

  1. Convert your structure into ember components. Create your rectangles using a template, so you can bind your actions and have ember rendering engine manage the whole thing.

  2. Keep the hack and handle the click event on your component, then use this.sendAction


#3

Thanks for the confirmation. :weary: