Knockout JS follows a MVVM approach. In the simple examples the ViewModel seems to hold two kinds of things:
- attributes of the Model object
- functions operating on the Model – typically via GUI interaction
While this is fine for smaller apps, as apps get bigger there is a growing need to define the Model clearly and separately. After tinkering a bit and some help from Stackoverflow I settled on this scheme. It has worked well for our app.
Define the model separately
Define the ViewModel
Define the View