Saturday, March 11, 2017

AngularJS - Introduction and Concepts

AngularJS is a javascript framework. It is a library written in javascript.It is distributed as a javascript file.It can be included in a webpage using a <script></script> tag.

Model-View-ViewModel (MVVM) or MV-Whatever Architecture:


AngularJS follows MVVM design pattern. There are three main components in this pattern.

Model: 

The raw data from the Database or the server.This component makes the call to the server to get the required data.It handles the Business logic.But it does not involve in displaying the data.

View: 

The User Interface i.e., the HTML and CSS. This component does not change the data , neither does it handles any event. It just displays the data.

ViewModel : 

The data that represents the state of the view.It handles the presentation logic.

Declarative Binder : 

Declaratively binds the model of the ViewModel to the view.We need not write any code for it.The AngularJS framework does the work for us.




MV-Whatever : 

AngularJS does not strictly follow MVVM design pattern. It is flexible enough to let the developers choose their pattern depending on the situation. Hence it is also called as MV-Whatever or MV*.

Dependency Injection by AngularJS:


Dependency Injection (DI) is a design pattern that implements Inversion of Control.The dependency is injected into the client by AngularJS.Client is not responsible for instantiating the dependency.
This helps in the loose coupling of the different components. AngularJS provides lot of components such as factory, value, service etc that can be injected into other components using DI.


No comments:

Post a Comment