I recently had an excellent opportunity to work on AngularJS as a part of an extended project responsibility. I was overwhelmed by the ease associated with this structural framework for dynamic web apps.
Here is why I believe one should start exploring and using AngularJS:
Build templates directly in HTML
One can build properly structured web applications using AngularJS expressions, directives, filters and data binding.
Expressions can be executed within the HTML pages. For example:
<div>1+1 = {{1+1}}</div>
Will result in 1+1 = 2
Directives – are used for structuring a page. For example: ng-repeat repeats the creation of new set of elements in the dom for each element in a collection.
<div>
<div data-ng-repeat=”users in user”>
<h2 >{{user.name}}</h2>
<h3>{{user.desc}}</h3>
</div>
</div>
Filters – changes the display of data in the page. For example:
We can place the name in upper case with {{user.name | uppercase}}
Data Binding – Provides automatic synchronization of data between the model and view components, thereby helps in binding data in scope and content of view. We can also perform bidirectional data binding where change in content of view also makes real time updates to data in scope for example:
<div>
<div data-ng-repeat=”users in user”>
<h2 >{{user.name}}</h2>
<h3>{{user.desc}}</h3>
Edit Description: <br />
<textarea rows = “5” col=”20” data-ng-model = “user.desc”>
</div>
</div>
Easy implementation of REST
REST has become a standard for communication between servers and clients. I discovered that with Angular JS, one line of code allows us to ‘talk’ to the server and revert with data for the web page.
Write less code
With AngularJS, as shown in the code above, the view can be defined within HTML. You can also use filters to change the data at view level i.e., within HTML without touching the controllers. It also removes the necessity to write getters/setters in data models.
Always be unit test ready
Though this aspect bears to undergo more research and analysis, to explore it in more detail, there is literature that proves that AngularJS has a mock HTTP provider that provides fake server responses to the controller instead of the person creating test pages that invoke a component and interact with it for testing purposes.
In conclusion, AngularJS has capabilities that allow you to express an application’s components clearly and succinctly. It makes the development and testing implementations easy and pleasant. It is certain that you cannot become an expert instantly but, my experience articulates it as easy to develop and all it requires is familiarity with a Model–View–Controller (MVC).
So go head and start exploring.