Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript templating with data bindings

I've been playing around with a few js templating engines. They all seem to offer fairly standard features and make generating html with JS much simpler.

I have yet to discover an engine though that offers data bindings on elements. I'd like to be able to do something like:

  1. render template with data to a particular div
  2. update all attributes from that template with new data (not by overwriting all the html)

I'd like this mainly so I don't have to keep adding events etc to the generated html. I have an app that is polling every 2 secs for new data and doing an innerHTML style update will make it very annoying as I have to repeatedly update the dom events associated with that html.

Has anyone seen this type of js template engine around?

like image 350
brad Avatar asked Nov 15 '22 09:11

brad


1 Answers

There was an earlier question “What good template language is supported in Javascript?”, in which @balupton mentions a Smarty implementation in JavaScript that can apparently do this.

like image 115
Stéphan Kochen Avatar answered Dec 09 '22 19:12

Stéphan Kochen