Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The code can work with the models without touching the DOM. You just access the models via ids.

eg

    parent_model = window.models[foo_model.get('parent_id')]
    parent_model.set('text', 'foo text')
When you respond to a button click or whatever, then yeah, you use a jQuery callback. The model id is stored in the DOM element (the view) which you access with $(this). Whenever the model changes (via set), the render function is automatically called. The render function is responsible for passing attributes to a template which renders html. Then the render function sticks the html wherever it's supposed to go. I think that's basically how all MVC frameworks work under the hood.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: