Created
January 1, 2012 23:13
-
-
Save PetrKaleta/1548614 to your computer and use it in GitHub Desktop.
How to append rendered Hogan.js template into some DOM element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use pre-compiled template | |
piicHTML = HoganTemplates.piic.render { link: '#', url: 'http://foo.bar/image.jpg' } | |
# used just for htmlString => DOMElement conversion | |
el = document.createElement 'span' | |
el.innerHTML = piicHTML | |
# append all first childs | |
@piicsContainer.appendChild el.firstChild while el.firstChild |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment