Created
September 3, 2014 22:19
-
-
Save al-the-x/8d0654fb3cad74c0f9b4 to your computer and use it in GitHub Desktop.
Using Lodash inside of Angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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