Getting To Know: HTML5 Local Storage

HTML5 local storage is an underutilized feature which allows developers to store data as key/value pairs within a user’s browser. While local storage may not be a replacement for cookies, it does offer 5MB to persist data beyond page refreshes and browser sessions. A working knowledge of HTML5 local storage is certainly worth adding to your tool belt.
Continue reading…

Angular ‘Controller As’ Communication Utilizing Services

For the past few years the primary means of communication between Angular controllers was to $broadcast events while your controllers listened by using $on handlers. While this certainly works, more and more (and more) Angular experts are moving away from $scope and utilizing Angular’s ‘Controller As’ syntax. With this syntax, we generally do away with injecting scope into our controllers, forcing better design practices, including using services to take over communication between controllers. While this may come off as strange at first if you are used to pub-sub or parent-child techniques, in the end it results in much thinner, more maintainable controllers and reusable services. In this post I am going to describe one technique for establishing controller communication using an Angular service as a mediator.
Continue reading…

Breaking down AngularJS Unit Testing

A strong suite of unit tests is incredibly valuable to any application. Through unit testing, confidence in your code (now and through refactorings) dramatically increases and a living documentation for your code base is born. Luckily for us, Angular was developed with testability at the forefront. Unfortunately for us, the formatting can be a bit strange and offer a barrier to those first getting into Angular unit testing. In this post I hope to clarify the common steps needed to get started constructing a reliable test suite.
Continue reading…