3 ms·
I never found merit to the point about not putting logic in templates. The impressive feature of knockout (and angular) is automatic updating of UI when model
by hasenj 14y ago
I never found merit to the point about not putting logic in templates.
The impressive feature of knockout (and angular) is automatic updating of UI when model data changes.
Knockout calls it "viewmodel", that is, the model is not necessarily your data model (though it could be!) but rather it's a model for the view: the state of the viewmodel determines the state of the UI.
Why would you say that this is wrong?
It even has a wikipedia page: http://en.wikipedia.org/wiki/Model_View_ViewModel http://en.wikipedia.org/wiki/Model_View_ViewModel (not that this matters, but it's a counter argument to "it's not standard").
- countessa 14y agoin fact, asp.net mvc is more of a MVVMC framework, so it's used server side as well.
- rudasn 14y agoI love the idea of viewmodel and automatic UI updates! What I don't really like is the implementation of that concept by these three frameworks. For example, from Knockout's homepage: http://knockoutjs.com/img/homepage-example.png http://knockoutjs.com/img/homepage-example.png That mixing of HTML and JS variables (in data-bind: chosenTicket, tickets) and behavior (click: resetTicket) looks very alien to me. It just doesn't feel right. It does make automatic UI update very very easy to implement but at what cost? Is code like this maintainable? Is it easily testable? Does is scale well?
- hasenj 14y agoHaven't used knockout heavily yet (but I plan to!). From what I can tell (mostly by intuition and experience), this looks at least more maintainable than typical MVC systems like Backbone.js