News for hackers. Stuff that matters.
Re:Agility.js - Javascript MVC for the "write less, do more"... by JesseAldridge on Friday July 22, 2011 @07:28PM (#2795567)
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.

There are no comments on this comment yet.