Passing a template in innerHTML javascript method


#1

I want to pass a template {{> exampleTemplate }} into innerHtml javascript method like this
selector.innerHtml("{{> exampleTemplate}}"); but it always parsed as a string, Am I doing it wrong or Is there another way to do it ?


#2

You can get the exact behaviour you’re looking for using Blaze.render

var element = document.querySelector('.my-selector');
Blaze.render('exampleTemplate', element);

But doing this is a warning sign that you’re using the wrong approach, as you should be able to dynamically render the things you want using ordinary Blaze templates

What exactly are you trying to do here?


#3

Thanks buddy, This is just what i wanted