Developer Depot

Developing Single Page Web Applications with AngularJS

Anyone who has experience developing a Single Page Application (SPA) with naked jQuery or raw JavaScript knows that doing so involves a lot of work for basic UI functions like keeping your Model and View in sync. You end up with hundreds or even thousands of lines of JavaScript devoted to basic functionality, before you can even begin writing your application logic. This is why teams of developers have put tremendous effort into making a variety of JavaScript application frameworks. You can take your pick from BackboneJS, EmberJS, AngularJS and others. Each has its own advantages, but for this post I'll just be talking about what AngularJS brings to the table.


There's a few key features that make AngularJS distinct from the alternatives. A big one is that Angular templates are written in HTML using directives (HTML5 data elements or custom attributes) for its template functionality. For example, if you have a list element that you'd like to repeat for each entry in an array, you use an ng-repeat directive on that list element like so:


<ul>
    
<li ng-repeat="cookie in cookies">{{ cookie.name }} : {{ cookie.description }}</li>
</ul>

Assuming you have an array called cookies with elements that contain both a name and description, you will get a list as you might imagine from the above in AngularJS


Angular will do automatic data binding as well, if the cookies array gets updated in your model, the view will automatically update. That means adding, removing or changing any of the elements in your model is automatically reflected to the user.


This is just a very basic introduction to some of the functionality AngularJS has on offer. For a more comprehensive overview I recommend checking out the official AngularJS site which contains detaield documentation as well as a number of videos.

Comments

#1 from Jorge on July 19, 2014

I have a question about your hosting service, do you ofer in your web hosting plan fastcgi?

#2 from Dave M. on July 28, 2014

PHP FastCGI can be set up and configured on our Dynamic VPS, Cloud VPS and Unmanaged Flex Dedicated Servers. Our standard managed packages do not currently use PHP FastCGI.

Add Your Comment








*Denotes a required field

Remember me?

 Email me when someone responds.