feat(NgFor): $last property support#3991
feat(NgFor): $last property support#3991alfonso-presa wants to merge 1 commit intoangular:masterfrom
Conversation
b45a573 to
fe18caf
Compare
There was a problem hiding this comment.
What about doing it in _perViewChange() to avoid having to iterate twice ?
ie view.setLocal('last', record.currentIndex === this.viewContainer.length - 1);
There was a problem hiding this comment.
That was my very first approach, but it made this expect fail because becoming (and also stop being) the last child of the collection is not considered to be a change by the DefaultIterableDiffer (and I think that's fair) and so the item is not included in the insertTuples.
There was a problem hiding this comment.
Oh right _perViewChange() is only called on records whose indexes have changed.
then LGTM, thanks.
|
👍 |
Makes a new `$last` property available during the loop with a boolean showing if it's the last item in the iteration. closes: angular#3102
fe18caf to
1bd44cb
Compare
|
Merging PR #3991 on behalf of @vicb to branch presubmit-vicb-pr-3991. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Makes a new
$lastproperty available during the loop with a booleanshowing if it's the last item in the iteration.
closes: #3102