Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-lodash

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-lodash

Lodash adapter for AngularJS.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
116
decreased by-17.14%
Maintainers
1
Weekly downloads
 
Created
Source

An AngularJS module adapting lodash

A fork of angular-underscore

This module exposes lodash's API into angular app's root scope, and provides some filters from lodash.

How to use

Install

After loading angular.js and lodash.js:

<script type="text/javascript" src="angular-lodash.js"></script>

Load angular-lodash

Load the whole library
angular.module('app', ['angular-lodash']);

Usecase

uniq
<script type="text/javascript">
  angular.module('example', ['angular-lodash']);
  app.controller('MainCtrl', function($scope) {});
</script>

<body ng-app="example">
  <div ng-controller="MainCtrl">
    <!-- output unique numbers from input.. [1, 2, 3, 4, 5, 6, 7, 8] -->
    <div ng-repeat="num in [1,1,2,3,4,5,5,6,6,7,7,7,8]|uniq">{{num}}</div>
  </div>
</body>
pluck
<script type="text/javascript">
  angular.module('example', ['angular-lodash']);
  app.controller('MainCtrl', function($scope) {
      $scope.exarr = [
        { 'name': 'John', 'age': 26 },
        { 'name': 'Bob', 'age': 41 },
        { 'name': 'Tom', 'age': 32 },
        { 'name': 'Ralph', 'age': 17 },
        { 'name': 'Molly', 'age': 13 }
      ];
  });
</script>

<body ng-app="example">
  <div ng-controller="MainCtrl">
    <div ng-repeat="age in exarr|pluck:'age'">{{age}}</div>
  </div>
</body>
keys
<script type="text/javascript">
  angular.module('example', ['angular-lodash']);
  app.controller('MainCtrl', function($scope) {                                                                                                                                                        
    $scope.exobj = {
      'key1': {
        'subkey1': 1
      },
      'key2': {
        'subkey2': 2
      },
      'key3': {
        'subkey3': 3,
        'subkey31': 31
      }
    };
  }); 
</script>

<body ng-app="example">
  <div ng-controller="MainCtrl">
    <div ng-repeat="k in exobj|keys">{{k}}</div>
  </div>
</body>

FAQs

Package last updated on 21 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc