How to improve Angular performance by disabling debugging

Angular gives elements classes such as ng-scope and ng-isolate-scope to help tools such as Batarang and Protractor retrieve debugging information. In production, these are unnecessary, and can be disabled to speed up your client-side application. This is how you disable debugging information in Angular: myApp.config(['$compileProvider', function ($compileProvider) { $compileProvider.debugInfoEnabled(false); }]);

How to throttle scroll events in AngularJS

If you watch the scroll event, you will probably find yourself handling far more events than you need. The scroll event fires really quickly, and that can be a problem on mobile devices. The following Angular directive will call a specified scroll event every 250 milliseconds. angular.module(‘hereApp.directive’).directive(‘onScroll’, function($timeout) { ‘use strict’; return { scope: { […]

Disable “pull to refresh” in Chrome for Android

In mobile Chrome, pulling the top of the page will reload it. Although it’s a convenient UI pattern, it might get in the way if you are trying to implement gestures in your app. After careful observation, I have come up with a simple solution. AngularJS I have successfully disabled “pull to reload” with this […]

Drag and drop image upload directive for Angular.js

While converting an application of mine to Angular.js, I could not come up with a reasonable way to support drag and drop uploads, so I have created my own. Browser support As with everything that is enjoyable on the web, this will only work in IE10+, Chrome and Firefox. This is because you will need […]

Using angular.js with Tastypie for Django

The following angular.js service will allow you to consume a standard TastyPie REST API. As you may know, TastyPie returns its JSON objects a bit differently from what angular expects, so this service fixes it. This example assumes that you have always_return_data=True in your resource. This is the resource I used with this example: class […]