Skip to content

Commit 0af7f6d

Browse files
committed
docs(collectionRepeat): add demo
1 parent 10f43d4 commit 0af7f6d

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

js/angular/directive/collectionRepeat.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,31 @@
33
* @module ionic
44
* @name collectionRepeat
55
* @restrict A
6+
* @codepen mFygh
67
* @description
78
* `collection-repeat` is a directive that allows you to render lists with
89
* thousands of items in them, and experience little to no performance penalty.
910
*
10-
* Demo:
11+
* Demo:
1112
*
12-
* The directive renders onto the screen only the items that should be currently visible.
13-
* So if you have 1,000 items in your list but only ten fit on your screen,
13+
* The directive renders onto the screen only the items that should be currently visible.
14+
* So if you have 1,000 items in your list but only ten fit on your screen,
1415
* collection-repeat will only render into the DOM the ten that are in the current
1516
* scroll position.
1617
*
1718
* Here are a few things to keep in mind while using collection-repeat:
18-
*
19+
*
1920
* 1. The data supplied to collection-repeat must be an array.
20-
* 2. You must explicitly tell the directive what size your items will be in the DOM
21+
* 2. You must explicitly tell the directive what size your items will be in the DOM
2122
* (pixel amount or percentage), using directive attributes (see below).
2223
* 3. The elements rendered will be absolutely positioned: be sure to let your CSS work with this (see below).
2324
* 4. Keep the HTML of your repeated elements as simple as possible. As the user scrolls down, elements
24-
* will be lazily compiled. Resultingly, the more complicated your elements, the more likely it is that
25+
* will be lazily compiled. Resultingly, the more complicated your elements, the more likely it is that
2526
* the on-demand compilation will cause jankiness in the user's scrolling.
2627
* 5. The more elements you render on the screen at a time, the slower the scrolling will be.
2728
* It is recommended to keep grids of collection-repeat list elements at 3-wide or less.
28-
* 6. Each collection-repeat list will take up all of its parent scrollView's space.
29-
* If you wish to have multiple lists on one page, put each list within its own
29+
* 6. Each collection-repeat list will take up all of its parent scrollView's space.
30+
* If you wish to have multiple lists on one page, put each list within its own
3031
* {@link ionic.directive:ionScroll ionScroll} container.
3132
*
3233
*
@@ -37,7 +38,7 @@
3738
*
3839
* Notice two things here: we use ng-style to set the height of the item to match
3940
* what the repeater thinks our item height is. Additionally, we add a css rule
40-
* to make our item stretch to fit the full screen (since it will be absolutely
41+
* to make our item stretch to fit the full screen (since it will be absolutely
4142
* positioned).
4243
*
4344
* ```html
@@ -121,8 +122,8 @@
121122
*
122123
* For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
123124
* to items in conjunction with a tracking expression.
124-
*
125-
* @param {expression} collection-item-width The width of the repeated element. Can be a number (in pixels) or a percentage.
125+
*
126+
* @param {expression} collection-item-width The width of the repeated element. Can be a number (in pixels) or a percentage.
126127
* @param {expression} collection-item-height The height of the repeated element. Can be a number (in pixels), or a percentage.
127128
*
128129
*/

0 commit comments

Comments
 (0)