Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor with blaze UI.Insert to specific div

i wanna to ask how to render and insert template to specific div. As we know from meteor wiki, this how to do that :

UI.insert(UI.render(Template.something), document.body);

and i place that to rendered or onAfterAction on IronRouter map, and it works. I have a div with id = "content", i wanna place the Template.something to that div, so i try with ordinary query code-like :

UI.insert(UI.render(Template.something), $('#content'));

and i place that to rendered or onAfterAction on IronRouter map, but it doesn't works. please help me how to render and insert to specific div? thanks

like image 988
yozawiratama Avatar asked Apr 01 '14 06:04

yozawiratama


1 Answers

As the documentation says, UI.insert() expects a DOM node as its second argument.

UI.insert( UI.render( Template.something ), $( '#content' ).get(0) ));

If that is not working then try both Template.something and $( '#content' ).get(0) in then dev console to see what values they have.

like image 53
user728291 Avatar answered Oct 02 '22 00:10

user728291