kikuyu1 kikuyu1 - 23 days ago 7
Javascript Question

AngularJS is perfect for Single Page Applications what is the meaning?

AngularJS is perfect for Single Page Applications (SPAs). I'm new to angularjs and this is the first statement I came across. What does this mean?

Answer Source

SPA is a Single Page Application where the browser loads the entire page once and refreshes part(s) of the page based on the request by the user during interaction.

Now we will look AngularJS Advantages,

Two-way-Data Binding: When ever data is changed the view automatically refreshes which means we don't need to load the entire page again.

Controllers: You can confine your logic only to particular part of the view using controllers. Which makes the view scope refer to only particular controller. This is brillinat way to control SPA.

Services: These are singleton objects which are instantiated only once when the application loads.

Directives: Directives are custom widgets. We create them once and use them where ever we need.

Routing: Switching views based on the user request.

Dependency Injection: AngularJS has a built-in dependency injection. You just need to say what you need and angular will arrange you that. A simple example is when you need severice functionalities in your Controller then just inject you service in your controller and proceed with the business logic.

MVC: Using AngularJS we can have Model, View, Controller architecture on the client side.

and many more.

These are some of the reasons why AngularJS is perfect for Single Page Applications.

Refer this wonderful video for more details on SPA and AngularJS.