agwisniewska / angular-lodash-module

Bridge to use lodash as a service in an Angular Controller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angular-lodash-module - Use Lodash from an Angular Controller or Service

Usage

  1. get it

    bower install angular-lodash-module
    
  2. Add angular-lodash-module.js to your main file (index.html)

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

    var myapp = angular.module('MyApp', ['lodash'])
  4. 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 lodash
    _.each(...);
    ...

References:

Lodash: http://lodash.com/ Stackoverflow: http://stackoverflow.com/questions/14968297/use-underscore-inside-controllers Github: https://github.com/kmc059000/angular-lodash-module

About

Bridge to use lodash as a service in an Angular Controller