AngularJS
AngularJS is a structural client-side open-source JavaScript Framework developed by Google.
AngularJS helps us to create single-page (one-page) applications with the help of HTML, CSS, and JavaScript on the client side.
As we know AngularJS follows the MVW* pattern and it allows to building of well-structured testable & maintainable front-end applications.
Note. W* means "whatever in" place of w we use C (controller) or VM (view model)
Why we are using AngularJS?
- As we know AngularJS based on the MVC pattern helps us to organize our web apps or web applications properly.
- It helps to make responsive & well-organized web applications that are more expensive & readable.
- It follows two-way data binding. Two-way data binding helps us any changes in model will be updated view & vice-versa without any manipulation of DOM or events.
- AngularJS support creates your own directive that makes reusable components to be used according to your requirements. It is also abstract DOM manipulation logic.
- It supports services & dependency injection which can easily be injected into our controller & provides some utility code as per our requirement.
Tips
NG is the AngularJS core module which is loaded default whenever AngularJS starts. NG module provided some essential components for the AngularJS app as it is Directive, Services/Factory, Filter & testing components.
Advantages of AngularJS
- AngularJS has code reusability that allows us to write code & reuse required as Custom directives.
- AngularJS supports powerful data binding it is two-way data binding with the help of HTML & scope.
- AngularJS is easily customizable as per our requirements. Here we can create our own custom components like directives & services.
- AngularJS has good support over the internet & time intervals 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 is easily testable Unit tests don't need to load all the apps, just loading that specific module is enough to start unit testing.
How is AngularJS different from other JS?
- AngularJS directly worked in the DOM.
- AngularJS used pojo which is called plain old JavaScript objects.
AngularJS Feature
- Module: It is like a container for different components.
- Directive: It is a combination of AngularJS template markups and supporting Javascript code.
- Template: It is a combination of HTML, directives, filters & attributes.
- Scope: It is a Java script object that refers to the application module.
- Expression: It is much like JavaScript expression. It uses {{Expression}} to show data in html.
- Data binding: Data binding is synchronized data between model & view.
- MVC Pattern: MVC pattern is also called model view controller.
- Validation: AngularJS provides you built-in validation directive to validate from the client side.
- Filters: It is used to format data before displaying users.
- Services: It is called reusable business logic.
- Routing: It helps you to divide your app into multiple views and bind different views to controllers.
- Dependency Injection: It is a software design pattern that deals with how components get hold of their dependencies.
- Injector: Container of dependency injection.
- Testing: The unit test doesn't need to load all the apps, just loading that specific module is enough to start unit testing.