angular-recursion

WebJar for angular-recursion

License

License

MIT
Categories

Categories

Github Development Tools Version Controls Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

github-com-marklagendijk-angular-recursion
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

angular-recursion
WebJar for angular-recursion
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/marklagendijk/angular-recursion

Download github-com-marklagendijk-angular-recursion

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/github-com-marklagendijk-angular-recursion/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>github-com-marklagendijk-angular-recursion</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-marklagendijk-angular-recursion/
implementation 'org.webjars.bower:github-com-marklagendijk-angular-recursion:1.0.4'
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-marklagendijk-angular-recursion/
implementation ("org.webjars.bower:github-com-marklagendijk-angular-recursion:1.0.4")
'org.webjars.bower:github-com-marklagendijk-angular-recursion:jar:1.0.4'
<dependency org="org.webjars.bower" name="github-com-marklagendijk-angular-recursion" rev="1.0.4">
  <artifact name="github-com-marklagendijk-angular-recursion" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='github-com-marklagendijk-angular-recursion', version='1.0.4')
)
libraryDependencies += "org.webjars.bower" % "github-com-marklagendijk-angular-recursion" % "1.0.4"
[org.webjars.bower/github-com-marklagendijk-angular-recursion "1.0.4"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower : angular jar [1.2.0,)

Project Modules

There are no modules declared in this project.

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 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.
            });
        }
    };
});

Versions

Version
1.0.4