AngularJS

Loading Configuration Data on Startup with AngularJS

Sep 14, 2016

Server-side web frameworks have various ways of storing and loading configuration settings - either use .properties, .xml, .yaml and then apply the built-in framework feature. Rails has excellent support for this and allows you to use a combination of environment-specific code files, .yaml configuration files and environment variables. But how do we push these environment variables into our Angular application?

Read More →

Working With Global Variables In AngularJS

Apr 6, 2015

Consider the following Angular code:

Read More →

Testing AngularJS Directives With Jasmine

Mar 28, 2015

When I first started using Angular one area I was particularly confused about was custom directives, and specifically how to test custom directives. I had a vague notion that directives can interact with the DOM (something which is to be avoided in controllers), but I didn’t really know when to use directives or how to test them (something which is pretty straightforward in controllers).

Read More →

Testing Asynchronous Code With AngularJS and Jasmine

Mar 27, 2015

One of the nice features about Angular is the testability. The dependency injection makes it easy to test components in isolation and stub out dependencies where necessary. However, it is not immediately obvious how to test asynchronous code. To illustrate how this works I am going to create an example (with asynchronous code) and test this using Jasmine.

Read More →

Working With Promises In AngularJS

Mar 26, 2015

Working with Angular (and JavaScript in general) means you really need to understand asynchronous code. The default way of handling this in Angular is to use promises - no more messy callbacks.

Read More →

Writing Custom Filters With AngularJS

Mar 25, 2015

Angular provides us with several filters which are useful formatting values inside our templates in a declarative way. The built-in filters are fairly useful, but the real power from filters comes from being able to write custom filters.

Read More →

Angular - Using Filters in Controllers

Mar 24, 2015

Angular provides us with several filters which are useful formatting values inside our templates in a declarative way. For example, we can use the number filter to round a given value to a specified number of decimals.

Read More →

Asynchronous Validations in AngularJS

Mar 10, 2015

One of the features introduced in Angular 1.3 is Asynchronous Validation. Angular already allows us to define custom validations, but all validations previously had to return inline. The new asynchronous validations allows us to return a promise from our custom validation. I’m going to build an example to see how this works.

Read More →

ngNYC Presentation – Advanced Directives

Nov 3, 2014

Thanks to everyone who attended my presentation ngNYC. As promised here are the slides and code samples for my presentation.

Read More →

Using Custom Directives in AngularJS

Sep 8, 2014

One of the areas I found the most confusing when starting out with Angular was directives. However, once I got comfortable with directives I found it to be true what most articles on directives were saying – they are really powerful and can really clean up your code.

Read More →

AngularJS Best Practices

Jul 29, 2013

Miško Hevery – the father of AngularJS – gave a very interesting presentation on AngularJS best practices in December of last year. This presentation is available on YouTube and the actual slides are on Google Docs.

Read More →

AngularJS Pain Points

Jul 11, 2013

I’ve been using AngularJS for almost 3 months. I had heard quite a lot about Angular before this time – many people were talking about it being the ‘next big thing’ and how it could become the defacto JavaScript framework for client-side development.

Read More →

Custom Sorting in AngularJS

May 9, 2013

Today I had to implement custom sorting in AngularJS. As with most things in Angular it’s very simple once you figure out how.

Read More →

Using ngResource with AngularJS

Apr 30, 2013

In my first post on AngularJS I created a simple Todo application with a Rails/Mongo RESTful server. In this application I was doing all my ajax calls manually (which is really easy in Angular), which meant most of my controller methods looked like this:

Read More →

Getting Started with AngularJS

Apr 24, 2013

Read More →