$position in repeat directive can't be both first and last at the same time #912

Closed
maxmart opened this Issue Apr 27, 2012 · 0 comments

Projects

None yet

2 participants

@maxmart
Contributor
maxmart commented Apr 27, 2012

Currently the $position property inside the repeat directive is either 'first', 'middle' or 'last'.
But if the list only has one item, the $position is set to 'first' by angular, even though it is actually both the first and last item.

Since this subtlety can't (reasonably) be represented by a single variable, something else is required. One way to solve it would be to have three boolean properties, $first, $middle and $last instead.

@IgorMinar IgorMinar added a commit that closed this issue May 22, 2012
@maxmart @IgorMinar maxmart + IgorMinar fix(ngRepeat): expose $first, $middle and $last instead of $position
$position marker doesn't work well in cases when we have just one item
in the list because then the item is both the first and last. To solve
this properly we need to expose individual $first and $middle and $last
flags.

BREAKING CHANGE: $position is not exposed in repeater scopes any more

To update, search for $position and replace it with one of $first,
$middle or $last.

Closes #912
1d38867
@IgorMinar IgorMinar closed this in 1d38867 May 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment