Hacker News new | comments | show | ask | jobs | submit login

Can you explain how templates make data binding easier? Working with the DOM means that you immediately can save a reference to an element, rather than generating the HTML and then traversing that HTML to get the element you want to change.

It's kinda a different technique altogether. Instead of writing code to respond to changes and then update specific DOM elements, you just create a template that has usually some kind of template variables/placeholders that the template engine will populate with data.

Then you "bind" that to some kind of object. Whenever the object changes, the framework then re-renders the template. So the effect is that when your model changes all of your UI components on the page just magically refreshes themselves.

Probably not the best explanation, but hopefully makes sense!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact