Wrapper underscorejs with AngularJS
You can choose your preferred method of installation:
- Through bower :
bower install angular-underscorejs
- Download from github : angular-underscore.js
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.
Released under the terms of the MIT License.