Recursive ng-include

8,969 views
Skip to first unread message

Brendan Owen

unread,
May 10, 2012, 3:20:03 AM5/10/12
to AngularJS
I am working on a presentation comparing Flex and AngularJS tried
recursive ng-include. It might be of interest to someone.

http://jsfiddle.net/brendanowen/uXbn6/8/

Bretto

unread,
May 10, 2012, 3:33:11 AM5/10/12
to ang...@googlegroups.com
Awesome, it shouldn't to hard to implement a show/hide function on the node....

Charlie

unread,
May 10, 2012, 6:11:00 AM5/10/12
to AngularJS
Nice!

ganaraj p r

unread,
May 10, 2012, 6:54:53 AM5/10/12
to ang...@googlegroups.com
Awesome love it :)

Nice!
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.




--
Regards,
Ganaraj P R

Adam Bradley

unread,
May 18, 2012, 12:24:51 PM5/18/12
to AngularJS
thanks for posting that, exactly what I was looking for!

Alain Duchesneau

unread,
Jun 20, 2012, 9:19:20 AM6/20/12
to AngularJS
That's cool, and what I was looking for. But when I try to adapt it to
my problem, nothing is displayed.

See at: http://jsfiddle.net/zzal/qdvuN/6/

Is it because we can't use ng-switch inside ng-includes?!


On 10 mai, 03:20, Brendan Owen <brendan.o...@gmail.com> wrote:
> I am working on a presentation comparing Flex and AngularJS triedrecursiveng-include. It might be of interest to someone.
>
> http://jsfiddle.net/brendanowen/uXbn6/8/

Alain Duchesneau

unread,
Jun 20, 2012, 9:31:14 AM6/20/12
to AngularJS
Got it!!

http://jsfiddle.net/zzal/qdvuN/9/

the template had to be inside the ng-app AND those single quotes in ng-
include directive... Why! Oh! Why!

thanks a lot anyhow!!

Alain Duchesneau

unread,
Jun 20, 2012, 9:38:57 AM6/20/12
to AngularJS

lulzim...@gmail.com

unread,
Nov 12, 2012, 8:43:22 AM11/12/12
to ang...@googlegroups.com
Nice.

I made a small change to add expand/collapse functionality :)

http://jsfiddle.net/uXbn6/91/

Benny Bottema

unread,
Jan 22, 2013, 4:44:59 AM1/22/13
to ang...@googlegroups.com
Two questions I have for this solution:

1. Is it possible to parameterize the controllers when they are bound to iElement? I would like to configure a child's content by some selection criteria in its parent
2. Is it possible to enhance this solution so that the controllers get access to their parents/children? Each element and it bound controller are now completely isolated

Bill Simons

unread,
Mar 6, 2013, 11:00:03 AM3/6/13
to ang...@googlegroups.com, lulzim...@gmail.com
This has been great!  I'm learning a lot about Angular JS just from working through this thread.

How would you implement something like this using directives?

Thanks,
Bill

Vitaly Vasilevsky

unread,
Mar 11, 2013, 10:34:36 AM3/11/13
to ang...@googlegroups.com

Thank you so much, Brendan!
I have searched for recursive rendering several days for this moment. 
You really helped me!
Message has been deleted

Maarten Berkenbosch

unread,
Oct 4, 2013, 4:29:35 PM10/4/13
to ang...@googlegroups.com
Beautiful code!


On Thursday, May 10, 2012 9:20:03 AM UTC+2, Brendan Owen wrote:

Robert Retzbach

unread,
Jul 18, 2014, 2:01:24 AM7/18/14
to ang...@googlegroups.com
With this I can probably avoid writing an own directive to render a tree, thank you!

Jens Melgaard

unread,
Jul 18, 2014, 7:10:41 AM7/18/14
to ang...@googlegroups.com
Have a look at: https://github.com/dotJEM/angular-tree

Makes it feel less "icky" to do this.

Alex Szilagyi

unread,
Dec 31, 2014, 10:51:10 AM12/31/14
to ang...@googlegroups.com
Maybe its getting old this topic and best approaches are already know but I'm wondering if any of you had similar scenario like this one. How should I handle recursively a JSON object if the child has a different key value name in JSON rather than his parent.

Jehanzeb Qayyum

unread,
Aug 4, 2015, 7:44:40 AM8/4/15
to AngularJS
After 10 levels nesting i start getting 
10 $digest() iterations reached. Aborting!
Reply all
Reply to author
Forward
Message has been deleted
0 new messages