Code Monkey home page Code Monkey logo

angular-recursion's People

Contributors

goldibex avatar techniq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-recursion's Issues

Passing attrs down through the recursive chain

Say I've defined a recursive directive:

<tree nodes="treeObject" can-select-multiple=true></tree>

I've added an attribute that tells the directive to allow the selection of multiple nodes in the tree. If this is the directive's template:

<ul>
    <li ng-repeat="node in tree">
        <span>{{node.text}}</span>
        <tree ng-if="node.children" nodes="node.children"></tree>
    </li>
</ul>

Is there any way to propagate the can-select-multiple=true attribute down to the inner tree directives? Or, more specifically, is it possible to pass the attrs argument available in the outer directive's compile (or link) function into the compile (or link) functions of the inner directives?

Performance

So just a passing thought - the performance of this technique will suffer linearly with the amount of elements in your model. Any thoughts on a way to improve this? Perhaps batching the appends into larger chunks, as opposed to one per directive?

Extra dom elements created

Here is the example:
http://jsfiddle.net/HB7LU/7721/

And screenshot:
screen shot 2014-10-28 at 9 25 12 am

The template within the recursive directive (gt-view) looks like this:

template: [
     '<div class="contents">',
          '<div class="gt-view-content">',
              '<h1>{{view.title}}</h1>',
          '</div>',
          '<div class="gt-view-child-container" ng-if="view.childView">',
              '<gt-view view="view.childView"></gt-view>',
          '</div>',
      '</div>',
].join('')

So regardless if childView is populated in the model, I am getting another gt-view rendered
Ideas?

Test has error

  1. should render the whole tree
    RecursionHelper
    Expected 0 to be 3.
    at
    at UserContext. (test/angularRecursionHelperSpec.js:70:32)
    at

Two way binding not completed

What I'd like to do is produce a recursively structured document corresponding to a tree structure in my model. The entire document is contentEditable and the models should react to changes made to an <li> within the view. I'm using the RecursiveHelper module to avoid endless loops. I'm still trying to figure out post-link, compile, etc. I'm a little confused which elements are associated with which controllers and scopes. I know that an iscolate scope is being created at each level of recursion, but I'm not sure how that affects my ability to reference variables within that iscolate scope as models to bind to.

In my main.js:

.directive('bullet',function(RecursionHelper){
    return {
        restrict: "E",
        scope:
            {
                node: '=node',
            },
        controller: function(),
        template:
            `
                <button class="btn btn-default" ng-click="node.toggleExpanded()" ng-show="node.children.length != 0">
                    <span ng-show="!node.expanded" class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                    <span ng-show="node.expanded" class="glyphicon glyphicon-minus" aria-hidden="true"></span>
                </button>
                {{node.content}}
                <ul class="list-group-sm" ng-show="node.expanded">
                    <li class="list-group-item" ng-repeat="child in node.children">
                        <bullet node="child" ng-model="child"></bullet>
                    </li>
                </ul>
            `,
      compile: function(element) {
          return RecursionHelper.compile(element, function(scope, elm, attrs, ctrl, transcludeFn){

          });
      }
    }
})

Then within my index.html:

<ul class="list-group-sm" contentEditable="true">
                        <li class="list-group-item" ng-repeat="child in currentBullet.children">
                            <bullet node="child"> </bullet>
                        </li>
                    </ul>

wrong scope - has to use parent scope

hey there! i just started trying out your extension, it looks good so far. one problem i encountered is that for some reason the template was not given the same scope as before i started using angular-recursion, but a child scope. the link function i used before (which i moved into the compile block of your function now) also has to do scope = scope.$parent, don't know what's going on. im using template files and am including them via templateUrl.
thanks!

ng-transclude is not compiled

If I use angular-recursion on my directive, transclusion will not work.
I get this error:
Error: [ngTransclude:orphan] Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found.

Bug when using require?

require: ['dhLayers'],
controller: dh.layer.layersDirectiveCtrl,
controllerAs: 'layersCtrl',

I want to use require: ['dhLayers','^?dhLayers'],
So that ctrls in link method => ctrls[0] == current layers control, ctrls[1] == parent layers control.

Instead the result I get is ctrls[0] is equal to ctrls[1] and the value represent the current directive controller.

Can you provide "name" for npm user?

Hi. I used npm for dependencies. I got error from your module.
npm ERR! Error: No name provided
If you add name to package.json, it will be helpful to me.

Anyway, thank you for your module.

Version mismatch for 1.0.5 tag

Currently the 1.0.5 git tag is pointing at the wrong commit 5ce7d0f instead of c95920d which is the commit that bumped the version numbers.

Fixing should be as easy as:

git tag -f 1.0.5 c95920d83de49e042719db6aa6c133eebb006e9b
git push --tags --force

Because of this error, bower is complaining about a version mismatch:

bower angular-recursion#~1.0.5         mismatch Version declared in the json (1.0.4) is different than the resolved one (1.0.5)

Modify original tree

I want to delete one element, just clicking on it, but how to access the parent for removing it?. And update the scope variable in the application controller

Directive Template vs TemplateUrl and Infinite digest

Hi there, I was hoping someone could give me a heads up regarding this issue:
When using an inline template like in the provided plunker the tree directive works fine. But if I switch the inline template to an html file using templateUrl I start getting an infinite digest.

  • Example using an inline template: Plunker
  • Example using html template: Plunker (Throws Infinite Digest)

Can someone explain me why is this happening? Is there a workaround? My template is to complex for using it inline.

Thanks in advance,
Leo.

Got a version mismatch at bower install angular-recursion

At installation:

λ bower install angular-recursion --save
bower not-cached    https://github.com/marklagendijk/angular-recursion.git#*
bower resolve       https://github.com/marklagendijk/angular-recursion.git#*
bower download      https://github.com/marklagendijk/angular-recursion/archive/1.0.1.tar.gz
bower extract       angular-recursion#* archive.tar.gz
bower mismatch      Version declared in the json (1.0.0) is different than the resolved one (1.0.1)
bower resolved      https://github.com/marklagendijk/angular-recursion.git#1.0.1
bower install       angular-recursion#1.0.1

angular-recursion#1.0.1 Applikation\js\bower_components\angular-recursion
└── angular#1.2.18

the version in bower.json is 1.0.0, installed version is 1.0.1. I think you have to prepare the new release with a new commit where you change the version number. Then put the relaease tag to this commit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.