Skip to content

Xen3r0/angular-underscorejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-underscorejs

Wrapper underscorejs with AngularJS


Installation

You can choose your preferred method of installation:

Usage

Include angular-underscore.js in your application.

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

Add the module xen3r0.underscorejs as a dependency to your app module:

angular.module('myApp', ['xen3r0.underscorejs']);

Inject service and use underscorejs functions:

angular.module('myApp')
  .controller('MyController', ['_', controllerFn]);
  
function controllerFn(_) {
  var myTab : [
    {
      id: 1,
      name: 'PHP'
    },
    {
      id: 2,
      name: 'JS'
    },
    {
      id: 3,
      name: 'HTML'
    }
  ];
  var indexedTab = _.indexBy(myTab, 'name');
}

Check Underscorejs for more functions.

License

Released under the terms of the MIT License.