ember.js - How do I programmatically add child views to an Ember view at specific DOM selectors? -
i have view uses 3rd party library render additional dom elements in didinsertelement hook. after these new elements added, need add child views inside them, can render dynamic data.
here's tried:
app.myview = ember.view.extend({ didinsertelement: function() { create3rdpartydomelements(); var element = this.$('someselector'); childview = this.createchildview(app.someviewclass, attributesdict); childview.appendto(element); } });
(jsbin: http://jsbin.com/idoyic/3)
this renders views expected, gives following assertion error ember rc 7: "you cannot append existing ember.view. consider using ember.containerview instead."
i have tried extending containerview, advised here , works, have no way of inserting child views @ specific dom selectors. inserts child views @ beginning of parent view.
can please me? lot!
you can render child views parent view's hidden div, , detach , append them arbitrary dom elements in didinsertelement
hook.
for related issue (components instead of views) see this question.
Comments
Post a Comment