Skip to content

andresesfm/angular-underscore-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-underscore-module - Use Underscore from an Angular Controller or Service

Usage

  1. Make sure you have included underscore.js in your project

    <script src="bower_components/underscore/underscore.js">

  2. get it

    bower install angular-underscore-module

  3. Add angular-underscore-module.js to your main file (index.html)

    <script src="bower_components/angular-underscore-module/angular-underscore-module.js"></script>

  4. Add the module as a dependency in your App definition

var myapp = angular.module('MyApp', ['underscore'])
  1. To use, add as an injected dependency to your Controller/Service and it is ready to use
angular.module('MyApp').controller('MyCtrl', function ($scope, _) {
    
    // Use underscore
    _.each(...);
    
});

References: