Google News
logo
Angular - Interview Questions
Describe the MVVM architecture.
MVVM Architecture removes tight coupling between each component. The MVVM architecture comprises of three parts:
 
* Model
* View
* ViewModel
 
The architecture allows the children to have reference through observables and not directly to their parents.
 
Model : It represents the data and the business logic of an application, or we may say it contains the structure of an entity. It consists of the business logic - local and remote data source, model classes, repository.

View : View is a visual layer of the application, and so consists of the UI Code(in Angular- HTML template of a component.). It sends the user action to the ViewModel but does not get the response back directly. It has to subscribe to the observables which ViewModel exposes to it to get the response.

ViewModel : It is an abstract layer of the application and acts as a bridge between the View and Model(business logic). It does not have any clue which View has to use it as it does not have a direct reference to the View. View and ViewModel are connected with data-binding so, any change in the View the ViewModel takes note and changes the data inside the Model. It interacts with the Model and exposes the observable that can be observed by the View.
Advertisement