Lazy Loading Angular (<= 1.3) Controllers

As your angular application grows, you'll quickly look for ways to distribute logic into manageable portions. You could (and should) simply produce js files dedicated to directives, controllers, and app separately, then use grunt to create your production file. But, you can do one better than that. You can simply not load entire sections of the site the user never visits. Through the use of require.js and angular's ui-router you can lazy load page controllers on demand, just like the template files.

File Breakdown

To make this work you'll need the following setup:

Tags: 

Drupal 7 Services List and Entity Reference Field Issues

I've been working on an angularjs project that features a Drupal services backend. As I'm new to angular (or was), I thought I had to have been doing something wrong posting data back to Drupal to save my user accounts. The response from the services backend would be a 406, with the messages:

406 (Not Acceptable : An illegal choice has been detected. Please contact the site administrator.)

Tags: 

Drupal 7 Services Example - PHP Curl

I had a need to consume a custom service I created in Drupal services. There's loads of tutorials on how to do that, feel free to google. But my previous code for using the api I created was for D6, a few things have changed. Looking around I found most examples were javascript, or using drupal's http library. I wrote a tiny little object just as a simple way to consume using curl for reference. It's not complete, but it lets you log in and out. You can take it from there to build what you need.

Tags: 

PHP Country Code ISO3 to ISO2 Mapping Array

Needed this for one my projects. Finding an ISO code 2 php array was immediate, but no one seems to have a 3 to 2 code mapping. Posting just to make people's googling more pleasant.

Tags: 

Pages

Subscribe to Fragmented Thought RSS