+1 for AngularJS

I’ve just spent a few weeks working on a (smallish) mobile-first portal application using AngularJS and Bootstrap at the client-side and mainly @RestResource Apex classes at the server-side. Despite the steep learning curve, I would encourage anyone looking to build a client-side MVC application to take a serious look at AngularJS. It is fun to work with, unobtrusive, and you end up with pretty clean (and testable) code and templates.

Here is one example of the elegance of AngularJS. If you are writing HTML/CSS pages, frameworks like JavaServer Pages and Visualforce require extra elements to be inserted for repetition or conditional rendering (at the server-side) that obscure the nesting of the HTML elements:

    <apex:repeat var="href" value="{!hrefs}">
            <a href="{!href}">Link</a>

AngularJS allows the use of much less intrusive attributes for this purpose:

        <a ng-repeat="href in hrefs" href="{{href}}">Link</a>

and is also nice enough to emit comments in the generated (at the client-side) HTML that help explain what happened.

I only discovered Batarang towards the end of my work. This extends Chrome’s Developer Tools with AngularJS-aware views such as the models contained in the various scopes.

I suggest buying a book to get a clearer understanding of the “why” as well as the “how”. The one I found in my local bookstore was AngularJS by Green & Seshadri. This has been a big help to me as have the egghead.io bite-sized videos.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s