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.

ngRepeat pass collection to transcluded scope #8282

Closed
@SimeonC

Description

@SimeonC

In the case of filtered ng-repeats (ng-repeat="type in types | filter: search") it would be really useful to add something like $collection to the transcluded scope at line L276.

Then we could easily access the filtered collection in our ng-clicks and ng-class functions like we access $index.

I imagine it would be changed like the following which wouldn't incur much overhead as it is just passing an object reference:

var updateScope = function(scope, index, collection) {
  scope.$collection = collection;
  ...
};

// then at line 364 and 377
updateScope(block.scope, index, collection);

I could probably run up a PR at some point if this is acceptable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions