3 ms·
Very nice writeup, probably one of the best practical articles on transitioning code to MVC-style structure. My only question about the result is the binding o
by Jare 14y ago
Very nice writeup, probably one of the best practical articles on transitioning code to MVC-style structure.
My only question about the result is the binding of NewStatusView.clearInput to the collection add event. If I understood correctly, it is logically incorrect in that clearing the input field should be a result of having submitted it, not of the fact that something has been added to the collection. A typical example to illustrate this issue would be a collaborative environment where multiple views/users can be adding to the same collection - say, a chat. Every submit would clear everyone else's text fields mid-typing?
- kjbekkelund 14y agoThanks! And great question. Of course, in real-time environments you need to be really sure which events trigger when. However, on a normal single-page app the add event will only be triggered when you have make a request to the server, and you won't do that mid-typing, only when you're finished typing. Edit: But, of course, as Robin_Message mentions, it's not always as clear cut as I stated, and there might be some issues with my solution.