Socket
Socket
Sign inDemoInstall

angular-recursion

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-recursion

An Angular service which helps with creating recursive directives.


Version published
Weekly downloads
6.9K
increased by20.72%
Maintainers
1
Install size
11.7 kB
Created
Weekly downloads
 

Readme

Source

angular-recursion

A service which makes it easy possible to have recursive Angular directives.

Why

When an Angular directive calls itself, Angular gets into an endless loop. This service provides the logic needed to work around this.

Installation

  1. bower install angular-recursion --save or npm install angular-recursion --save.
  2. Include bower_components/angular-recursion/angular-recursion.min.js.
  3. Add the RecursionHelper module as a dependency.
  4. Inject the RecursionHelper service and use it.

Usage

Inject the RecursionHelper service into your directive, and use it in the compile function, as shown in the example below. The example is also available as a Plunker, so you can see it running.

angular.module('myModule', ['RecursionHelper']).directive("tree", function(RecursionHelper) {
    return {
        restrict: "E",
        scope: {family: '='},
        template: 
        '<p>{{ family.name }}{{test }}</p>'+
            '<ul>' + 
                '<li ng-repeat="child in family.children">' + 
                    '<tree family="child"></tree>' +
                '</li>' +
            '</ul>',
        compile: function(element) {
            return RecursionHelper.compile(element, function(scope, iElement, iAttrs, controller, transcludeFn){
                // Define your normal link function here.
                // Alternative: instead of passing a function,
                // you can also pass an object with 
                // a 'pre'- and 'post'-link function.
            });
        }
    };
});

Keywords

FAQs

Last updated on 23 Feb 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc