marklagendijk / angular-recursion Goto Github PK
View Code? Open in Web Editor NEWA service which makes it easy possible to have recursive Angular directives.
License: MIT License
A service which makes it easy possible to have recursive Angular directives.
License: MIT License
It works with angular 1.2.26, but once upgraded to angular 1.3, the grid won't show up in recursion.
The grid outside of the recursion works as expected though.
Here is the example:
http://jsfiddle.net/HB7LU/7721/
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?
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.
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.
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.
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?
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?
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!
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
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>
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.
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.
<tree family="treeFamily">
<a href="javascript://" ng-click="toggleChildren(item)"> {{item.name}} </a>
</tree>
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)
1.3.0 landed so, it would be good to get this updated.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.