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

ng-repeat track by $index with custom directive #16332

Closed
@michael-letcher

Description

@michael-letcher

I'm submitting a ...

  • bug report
  • feature request
  • other

Current behavior:

After filtering and array that is being repeated and has a custom directive in each repeated element that has an isolated scope. The custom directive is not reinitiated.

I assume this is expected behaviour but can be confusing and should be made clearer as to what putting track by $index can do to your custom directives.

Expected / new behavior:
NA

Minimal reproduction of the problem with instructions:

  1. create ng repeat with a custom directive inside (include track by $index)
  2. using $filter on the repeat array filter the array and you will notice the data in the directive will not reflect the new filtered array

AngularJS version: 1.5.10

Browser: all

Anything else:

Could the docs be made more clear between the what Angular is doing when using track by and that using $index with custom directives is not going to work.

Check my response here for a break down of the issue
https://stackoverflow.com/a/47310734/2536454

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions