+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:

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

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

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

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.