Re: [angular.js] Re: ng-repeat tree-table

1,849 views
Skip to first unread message

Peter Bacon Darwin

unread,
Jul 18, 2012, 10:35:29 AM7/18/12
to ang...@googlegroups.com

Do you realise that the element that contains the ng-repeat is the thing that gets repeated. You have a ng-repeat on a tbody element.

Pete
...from my mobile.

On Jul 18, 2012 2:19 PM, "Alex Figueiredo" <alexx...@gmail.com> wrote:
I don't like doing this, but just in case my question passed unnoticed. =)

Does anyone know if I'll be able to do that with ng-repeater and <table> ?

Thanks!

Em quinta-feira, 12 de julho de 2012 15h45min51s UTC-3, Alex Figueiredo escreveu:
I'm trying to make a groupable table using angular.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/tCCKl0ClBZAJ.
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.

Peter Bacon Darwin

unread,
Jul 18, 2012, 11:27:42 AM7/18/12
to ang...@googlegroups.com
Sadly you can't do any kind of "don't render me" for ng-repeat - it would be nice if we could have the directive in a comment but no.
The reason the third repeat is not running is because you have put it outside of the second repeat:

<tbody ng-repeat="item in itens>
  <tr ng-repeat="tipo in item.Rows">
  </tr>
  <tr ng-repeat="n in tipo.Rows">
  </tr>
</tbody>

Each repeat creates a scope and adds the current item to that scope.  The last repeat is trying to access tipo from outside the scope of the second repeat.  The last tr would need to be inside the second tr, which obviously doesn't make sense.

I think the only way you can really do this is with nested tables.  Something like this: http://jsfiddle.net/ZaSgb/9/

Pete 

On 18 July 2012 16:06, Alex Figueiredo <alexx...@gmail.com> wrote:
Hi Pete,

My problem is that my data is hierarchical.

Thus, using a list works very fine, for example:


But in my case, I would like to render <tr> individual elements for each level.

I was hoping to do something like:

<dont_render_me nr-repeat="item in parent.children">
  <tr...
</dont_render_me>
 
Do you think I can do it otherwise? Thanks for your help! 

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/An9hKsrUE7YJ.
Reply all
Reply to author
Forward
0 new messages