3 ms·
Forgetting to use bind can be a good thing. See my comment above. As for writing things "the Angular way", it's about truly separating your MVC layers using tw
by EGreg 12y ago
Forgetting to use bind can be a good thing. See my comment above.
As for writing things "the Angular way", it's about truly separating your MVC layers using two way databinding. I don't care how you do it as long as you keep V as declarative as possible. It sounds like "the javascript way" for you might just involve a lot of storing data in the DOM.
I think a much more robust pattern involves:
A Model - This is Javascript data stored outside the DOM, for easy manipulation. It is usually accessible via the window object
A ViewModel - This is Javascript data that is stored outsidd the DOM but is referenced directly by a data-bound component. It can involve view transformations such as time/date localization.
A View - This is the actual DOM component, in Angular it is a "directive". It reacts to changes in the ViewModel and can also change the Model (which in turn changes the ViewModel).
That way, for example, if you want to implement optimistic visual feedback you can do it in the Model and have the model try to sync or revert.
All this becomes even more complex when you have to build multi user apps. You can use Firebass or Parse etc. or you can check out http://platform.qbix.com http://platform.qbix.com -- open sourced but still a work in progress until 1.0
- xtrumanx 12y ago> It sounds like "the javascript way" for you might just involve a lot of storing data in the DOM. I don't think I've ever modified the DOM directly when using React. Try it out, it's a really refreshing take on building client-side apps.