Skip to content

Instantly share code, notes, and snippets.

@al-the-x
Created September 3, 2014 22:19
Show Gist options
  • Save al-the-x/8d0654fb3cad74c0f9b4 to your computer and use it in GitHub Desktop.
Save al-the-x/8d0654fb3cad74c0f9b4 to your computer and use it in GitHub Desktop.
Using Lodash inside of Angular
angular.module('myModule', [ ], function($rootScope){ // equivalent to .config(function($rootScope){ . . . })
$rootScope._ = _; // Make `_` available in Angular Expressions
}).controller('MyController', function(Something){
var saveSomething = this.saveSomething = Something.save();
$scope.$watch('something', _.debounce(saveSomething, 500));
$scope.something = 'some value';
})
; // END myModule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment