I am wondering what properties,method, or variables in a typical ViewModel make it different from a Model.
I am wondering what properties,method, or variables in a typical ViewModel make it different
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The MVVM explanation:
A model is about your domain. Classic examples are customers, orders, order-details etc. These are oblivious to your user interface. Often models doesn’t contain any code that are delegated to some services.
A view-model is about how your present what is in the view-model. Say you have a view with an order with details. The view-model may contain state about the current order-detail and other visible state like should the delete button be enabled? It also references the models presented by the view-model e.g. an order and a collection of order-details. The view-model also has ways to perform actions like deleting the current order-detail etc.