As we know that AngularJS follow MVW* pattern and it allow to build well-structured testable & maintainable front end application.
Note: W* means "whatever in" place of w we use C (controller) or VM (view model)
Why we are use AngularJS
- As we know that AngularJS based on MVC pattern help us to organize our web apps or web application properly.
- It helps to make responsive & well organized web application that is more expensive & readable.
- It follows two way data binding. Two way data binding help us any changes in model will be update view & vice-versa without any manipulation on DOM or events.
- AngularJS support create your own directive that make reusable component to be used according to your requirement. It is also abstract DOM manipulation logic.
- It supports services & dependency injection which can easily inject in our controller & provide some utility code as per our requirement.
Tips: NG is AngularJS core module which is loaded default whenever AngularJS started. NG module provided some essential component for AngularJS app as it is Directive, Services/Factory, Filter & testing components.
Advantages of AngularJS
- AngularJS have code reusability that allow us to write code & reuse required as Custom directive.
- AngularJS support powerful data binding it is two way data binding with the help of HTML & scope.
- AngularJS is easily customizable as per our requirement. Here we can create own custom components like directive & services.
- AngularJS has good support over internet & time interval it has new changes available for developers. It also supports IE, Opera, Safari, and Chrome.
- AngularJS has inbuilt form validation & template with all old plain html.
- AngularJS has easily testable Unit test doesn't need to load all the app, just loading that specific module is enough to start unit testing.
How AngularJS Different With Other JS
- AngularJS directly worked in the DOM.
- Module: It is like a container for different components.
- Directive: It is combination of AngularJS template markups and supporting java script code.
- Template: It is a combination of html, directive, filters & attribute.
- Scope: It is java script object that refers to the application module.
- Data binding: Data binding is synchronized data between model & view.
- MVC Pattern: MVC pattern also called model view controller.
- Validation: AngularJS provides you built in validation directive to validate from client side.
- Filters: It is used for format data before display users.
- Services: It calls reusable business logic.
- Routing: It helps you to divide your app in multiple views and bind different view to controllers.
- Dependency Injection: It is software design pattern that deals with how component get hold of their dependencies.
- Injector: Container of dependency injection.
- Testing: Unit test doesn't need to load all the app, just loading that specific module is enough to start unit testing.