Most frameworks are simply a bundling of existing tools. They are not elegant. Angular is the framework where each and every tool is designed to work with every other tool in an interconnected way.
Here are some reasons why you should be using Angular today.
- MVC done right
Apart from other MVC, Angular implements MVC by asking you to split your app into MVC components and then Angular will do the rest thing. Angular just not manages your components but act as a mediator between all different components.
- A declarative user interface
Using Angular for attributes you can determine “what” gets loaded, but not “how”. This declarative approach greatly simplifies app development in a sort of WYSIWYG (what you see is what you get) way. You can define what you want and Angular will take care of the dependencies and this will cut down the time for how the program will flow.
- Data models are POJO
Angular’s data models are plain objects; they behave more like a temporary storage area for people to get the data. However, Angular’s this storage work closely with a controller and view. To differentiate it from the traditional sense of data models, Angular calls them “scopes”.
All properties found on the scope object are automatically bound to the view by Angular. Meaning, Angular quietly watches for changes to these properties and updates the view automatically.
The scope has no data to begin with and relies on the controller to feed it data according to business logic needs.
- Flexibility with filters
Filters are designed to be standalone functions that are separate from your app, similar to Directives, but are only concerned with data transformations.
- Write less code
All the points up till now mean that you get to write less code. You don’t need to write your own MVC pipeline. The view is defined using HTML, which is more concise. Data models are simpler to write without getters/setters. Data-binding means you don’t have to put data into the view manually. Since directives are separate from app code, they can be written by another team in parallel with minimal integration issues. Filters allow you to manipulate data on the view level without changing your controllers. So this will save the time of developers because you don’t need to write so many lines of code.
- DOM manipulations where they belong
Traditionally, the view modifies the DOM to present data and manipulates the DOM (or invokes jQuery) to add behavior. With Angular, DOM manipulation code should be inside directives and not in the view. Angular sees the view as just another HTML page with placeholders for data. This way of looking at the view pairs nicely with user interface designers.
By abstracting out the DOM manipulations and jQuery calls, user interface designers are able to focus on the view without those distractions.
By making your MVC app purely about presenting business data into views, and not have to worry about manipulating DOM, web app development suddenly became more fun.
- Context aware communication
We know that the view can be bound to properties on the current scope but scopes inherit the properties of their parent scopes. That means if a property exists on the parent scope, and a child scope modifies it, then all other scopes that inherit from the same parent will also see the same modification and their views will be updated automatically by Angular! This automated way beats using PubSub.
- Unit testing ready
The whole of Angular is linked together by Dependency Injection (DI). It’s what it uses to manage your controllers and scopes. Because all your controllers depend on DI to pass it information, Angular’s unit tests are able to usurp DI to perform unit testing by injecting mock data into your controller and measuring the output and behavior. In fact, Angular already has a mock HTTP provider to inject fake server responses into controllers.
This beats the more traditional way of testing web apps by creating individual test pages that invoke one component and then interacting with it to see if it works.
Angular use the spa architecture (single page application) this mean that you don’t have to retrieve HTML from server side on every request. All your html files are loaded in your first server request and angular manage them in a single page.
Thanks to Angular you will minimize calling the server side which will be called only when we have to retrieve data from database or post something via Json files.
Share Your thoughts with comments Why you like Angular Js.
Level up every day