|
|
|
|
|
by binspace
5579 days ago
|
|
I used to organize js binding based on the controller (https://github.com/pivotal/jelly), but found that it is better to base it on the template. There are a few reasons: 1. It makes more conceptual sense. The javascript relates to html (which is generated by the template), not a controller action. 2. You will probably want to reuse templates across different controllers. Also partial templates can have reusable behavior. 3. It is easier to move between the associated javascript + template 4. Refactoring is easier, especially with html gotten via AJAX |
|