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

Commit bb8c3ec

Browse files
pdfpkozlowski-opensource
authored andcommitted
docs(ngRepeat): add example for filters in conjunction with track by
1 parent b99d064 commit bb8c3ec

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ng/directive/ngRepeat.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
* * `variable in expression` – where variable is the user defined loop variable and `expression`
8181
* is a scope expression giving the collection to enumerate.
8282
*
83-
* For example: `track in cd.tracks`.
83+
* For example: `album in artist.albums`.
8484
*
8585
* * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
8686
* and `expression` is the scope expression giving the collection to enumerate.
@@ -91,7 +91,8 @@
9191
* which can be used to associate the objects in the collection with the DOM elements. If no tracking function
9292
* is specified the ng-repeat associates elements by identity in the collection. It is an error to have
9393
* more than one tracking function to resolve to the same key. (This would mean that two distinct objects are
94-
* mapped to the same DOM element, which is not possible.)
94+
* mapped to the same DOM element, which is not possible.) Filters should be applied to the expression,
95+
* before specifying a tracking expression.
9596
*
9697
* For example: `item in items` is equivalent to `item in items track by $id(item)'. This implies that the DOM elements
9798
* will be associated by item identity in the array.
@@ -101,10 +102,13 @@
101102
* with the corresponding item in the array by identity. Moving the same object in array would move the DOM
102103
* element in the same way ian the DOM.
103104
*
104-
* For example: `item in items track by item.id` Is a typical pattern when the items come from the database. In this
105+
* For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
105106
* case the object identity does not matter. Two objects are considered equivalent as long as their `id`
106107
* property is same.
107108
*
109+
* For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
110+
* to items in conjunction with a tracking expression.
111+
*
108112
* @example
109113
* This example initializes the scope to a list of names and
110114
* then uses `ngRepeat` to display every person:

0 commit comments

Comments
 (0)