Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Ng-repeat-start with Ng-repeat causes ng-class, etc to not work #4002

Closed
gelicia opened this issue Sep 13, 2013 · 5 comments
Closed

Ng-repeat-start with Ng-repeat causes ng-class, etc to not work #4002

gelicia opened this issue Sep 13, 2013 · 5 comments

Comments

@gelicia
Copy link

gelicia commented Sep 13, 2013

When an ng-repeat-start/end block is used with another ng-repeat then ng-class, ng-hide etc do not work on the ng-repeat-start block.

Plunkr is here : http://plnkr.co/edit/Hjqpqbuy0nhrTOmCjk36?p=preview

  • ng-repeat-start (team level in the example)
    • Without ng-repeat: ng-class and ng-hide works
    • With ng-repeat: ng-class and ng-hide does not work
  • ng-repeat (member level in the example)
    • Without ng-repeat-start: ng-class and ng-hide works
    • With ng-repeat-start: ng-class and ng-hide works

The workaround is using two ng-repeats, one on tbody to loop through the teams, then create the team row, then loop through the members to create the members rows.

@petebacondarwin
Copy link
Contributor

Duplicate of #3104?

@rodyhaddad
Copy link
Contributor

@petebacondarwin This one is a lot more complicated than #3104, maybe it's better to keep it open and close it once we're sure that it's fixed?

@petebacondarwin
Copy link
Contributor

OK!

@ghost ghost assigned jeffbcross Sep 19, 2013
@jeffbcross
Copy link
Contributor

The first problem I see is that ng-repeat-start is complaining that there's no matching ng-repeat-end. It stops complaining if you remove the ng-repeat of the second <tr>. This seems to be a problem in groupScan() in the compiler, which I'm looking into now.

@rodyhaddad
Copy link
Contributor

@jeffbcross I'm guessing it's because of the transclusion. The element with ngRepeat gets replaced with a comment (<!-- ngRepeat : ... -->, and so ng-repeat-end can't be found.

jeffbcross added a commit to jeffbcross/angular.js that referenced this issue Sep 21, 2013
jankuca added a commit to jankuca/angular.js that referenced this issue Sep 26, 2013
…ingle element

The problem was in keeping the values of `attrNameStart` and `attrNameEnd` between directive loop iterations which lead to the compiler looking for multi-element ranges for any directives that happened to be in the directive list after one that was applied on a range. For instance, having a ng-repeat-start and ng-class on a single element with ng-repeat being resolved first made the compiler look for an ng-repeat-end for both ng-repeat and ng-class because the `attrNameEnd` was not reset to a falsy value before the second iteration. As the result, an exception saying the block end element could not be found and the second directive was not actually applied.

Closes angular#4002
jankuca added a commit to jankuca/angular.js that referenced this issue Sep 26, 2013
… element

The problem was in keeping the values of `attrNameStart` and `attrNameEnd` between directive loop iterations which lead to the compiler looking for multi-element ranges for any directives that happened to be in the directive list after one that was applied on a range. For instance, having a ng-repeat-start and ng-class on a single element with ng-repeat being resolved first made the compiler look for an ng-repeat-end for both ng-repeat and ng-class because the `attrNameEnd` was not reset to a falsy value before the second iteration. As the result, an exception saying the block end element could not be found and the second directive was not actually applied.

Closes angular#4002
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
The problem was in keeping the values of `attrNameStart` and `attrNameEnd` between directive loop iterations which lead to the compiler looking for multi-element ranges for any directives that happened to be in the directive list after one that was applied on a range. For instance, having a ng-repeat-start and ng-class on a single element with ng-repeat being resolved first made the compiler look for an ng-repeat-end for both ng-repeat and ng-class because the `attrNameEnd` was not reset to a falsy value before the second iteration. As the result, an exception saying the block end element could not be found and the second directive was not actually applied.

Closes angular#4002
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
The problem was in keeping the values of `attrNameStart` and `attrNameEnd` between directive loop iterations which lead to the compiler looking for multi-element ranges for any directives that happened to be in the directive list after one that was applied on a range. For instance, having a ng-repeat-start and ng-class on a single element with ng-repeat being resolved first made the compiler look for an ng-repeat-end for both ng-repeat and ng-class because the `attrNameEnd` was not reset to a falsy value before the second iteration. As the result, an exception saying the block end element could not be found and the second directive was not actually applied.

Closes angular#4002
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.