AngularJS
Loading Configuration Data on Startup with AngularJS
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?
Working With Global Variables In AngularJS
Consider the following Angular code:
Testing AngularJS Directives With Jasmine
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).
Testing Asynchronous Code With AngularJS and Jasmine
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.
Working With Promises In AngularJS
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.
Writing Custom Filters With AngularJS
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.
Angular - Using Filters in Controllers
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.
Asynchronous Validations in AngularJS
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.
ngNYC Presentation – Advanced Directives
Thanks to everyone who attended my presentation ngNYC. As promised here are the slides and code samples for my presentation.
Using Custom Directives in AngularJS
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.
AngularJS Best Practices
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.
AngularJS Pain Points
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.
Custom Sorting in AngularJS
Today I had to implement custom sorting in AngularJS. As with most things in Angular it’s very simple once you figure out how.
Using ngResource with AngularJS
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: