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

Using ng-if with ng-repeat-end leads to unexpected results #4398

Closed
vvolodin opened this issue Oct 13, 2013 · 1 comment
Closed

Using ng-if with ng-repeat-end leads to unexpected results #4398

vvolodin opened this issue Oct 13, 2013 · 1 comment

Comments

@vvolodin
Copy link

I'm using the following markup two output data in 2 columns:

<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-class="clearfix" data-ng-repeat-end="" data-ng-if="!$even"></div>

It works well on the first load but when I dynamically change my upcoming.forecasts array all my clearfix divs end up at the bottom of the container, looks something like this:

<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-repeat-start="forecast in upcoming.forecasts">
</div>
<div data-ng-class="clearfix" data-ng-repeat-end="" data-ng-if="!$even"></div>
<div data-ng-class="clearfix" data-ng-repeat-end="" data-ng-if="!$even"></div>
<div data-ng-class="clearfix" data-ng-repeat-end="" data-ng-if="!$even"></div>
@matsko
Copy link
Contributor

matsko commented Oct 13, 2013

This is a known bug. And at the moment unfortunately there isn't a workaround other than placing the IF and REPEAT directives on separate elements. Please take a look at this: #3584 (comment)

@matsko matsko closed this as completed Oct 13, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants