Skip to content

Feature request: $last support in ng-for #3102

Closed

Description

@siggisim

Would like to be able to do something like:

<div *ng-for="var item of items">
      <div [class.selectable]="$last">Foo</div>
</div>

Activity

  1. added
    featureLabel used to distinguish feature request from other issues
    area: commonIssues related to APIs in the @angular/common package
    on Jul 17, 2015
  2. matanlurey commented on Jul 17, 2015

    @matanlurey
    Contributor

    Just to clarify, you can do var items of items, var last = items.length - 1 today, right?

  3. matanlurey commented on Jul 17, 2015

    @matanlurey
    Contributor

    Also, this makes sense for a List, but what if it is an Iterable and doing a length calculation is expensive?

  4. siggisim commented on Jul 17, 2015

    @siggisim
    Author

    For an iterable, this would be true if hasNext is false. The length approach wouldn't work for iterables. A workaround that we're using right now is item == items.last, but this has issues if equals is overridden.

  5. added a commit that references this issue on Sep 4, 2015
    be95411
  6. pkozlowski-opensource commented on Sep 16, 2015

    @pkozlowski-opensource
    Member

    This was already fixed by be95411

  7. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: commonIssues related to APIs in the @angular/common packageeffort1: hoursfeatureLabel used to distinguish feature request from other issuesopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions