>From my perspective, it is weird to nest ng-repeats with the same iterator.
At the very least, I'd do [[cellA in cells]] and [[cellB in cells]]. My
intuition would be that the inner repeat would shadow the outer, but
javascript has weird ways of dealing with variables, and I don't know if
the inner and outer repeats are evaluated in their own closures or not.

It is also weird to modify the iterator value. If you want to display
something like that, I'd use just plain [[cell+2]], or more directly,
something *like* [[cell+2*$index]], except you'd want the $index that's
associated with the outer loop and not the inner. I'm not sure how to grab
that value directly (could be a good call for an ng-init use there, like an
ng-init="outerIndex = $index" somewhere in the outer loop. Maybe.

What would also be interesting is outputting the value of [[cells]] on the
page. I'm actually surprised the code doesn't throw infinite digest errors
(maybe it does, check the console in the debugger) - row two would
hypothetically cause row one's values to need to be higher, since it looks
like you may well be modifying the array itself. But the guts of angular
here are kind of arcane - all these ng-repeats are micro-syntaxes that are
not standard javascript and are compiled into Js at runtime and evaluated.
Which is why they're looking to change this stuff in 2.0.

e



On Thu Nov 13 2014 at 6:44:24 AM Chris Geir*** <[email protected]>
wrote:

> Hey Sander,
>
> I wasn't trying to accomplish anything. I was basically just hacking and
> wanted to see what would happen. The problem is, I couldn't wrap my mind
> around what happened so that I could understand the mechanics. I'm just
> trying to make sense of the results and learn from it.
>
> For the first, most top-left cell under the header, I would expect that
> value to be 2 (0 = 0+2), but it is 22. Why?
>
> For the second, to the right of the previous cell, I would expect that
> value to be 4 [or maybe even 6] (2 = 2+2), but it is 23. Why?
>
> Is there a way to output a static representation of a bound variable? If
> so, then I could output the static expressions to see if that 'adds up' :)
>
> Thanks for your respose,
>
> Chris
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to