You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Listing `ANY` for the tag, the directive can be applied to, stretches the truth - a little bit. The directive works well with majority
@@ -81,6 +83,10 @@ _Important!_ The viewport height must be constrained. If the height of the viewp
81
83
in the datasource. Even if it does not, using the directive this way does not provide any advantages over using ng-repeat, because
82
84
item template will be always instantiated for every item in the datasource.
83
85
86
+
_Important!_ There is a Scroll Anchoring feature enforced by Google Chrome (since Chrome 56) which makes scroller behaviour incorrect.
87
+
The ui-scroll-viewport directive eliminates this effect by disabling the 'overflow-anchor' css-property on its element.
88
+
But if the ui-scroll-viewport is not presented in the template, you should take care of this manually.
89
+
84
90
85
91
### Examples
86
92
@@ -152,19 +158,14 @@ It is empty since it was deprecated in v1.6.0.
152
158
153
159
Some of the properties offered by the adapter can also be accessed directly from the directive by using matching attributes. In the same way as for the adapter attribute, syntax for such attributes allows for providing a reference expression to be used to access the corresponding value. Below is a list of such attributes:
154
160
155
-
***is-loading - assignable expression**, optional - a boolean value indicating whether there are any pending load requests will be injected in the appropriate scope. See also `isLoading` adapter property.
156
-
***top-visible - assignable expression**, optional - a reference to the item currently in the topmost visible position will be injected in the appropriate scope. See also `topVisible` adapter property.
157
-
***top-visible-element - assignable expression**, optional - a reference to the DOM element currently in the topmost visible position will be injected in the appropriate scope. See also `topVisibleElement` adapter property.
158
-
***top-visible-scope - assignable expression**, optional - a reference to the scope created for the item currently in the topmost visible position will be injected in the appropriate scope. See also `topVisibleScope` adapter property.
161
+
***is-loading - assignable expression**, optional - a boolean value indicating whether there are any pending load requests will be injected in the appropriate scope. See also `isLoading` adapter property, which is preferable.
162
+
***top-visible - assignable expression**, optional - a reference to the item currently in the topmost visible position will be injected in the appropriate scope. See also `topVisible` adapter property, which is preferable.
163
+
***top-visible-element - assignable expression**, optional - a reference to the DOM element currently in the topmost visible position will be injected in the appropriate scope. See also `topVisibleElement` adapter property, which is preferable.
164
+
***top-visible-scope - assignable expression**, optional - a reference to the scope created for the item currently in the topmost visible position will be injected in the appropriate scope. See also `topVisibleScope` adapter property, which is preferable.
159
165
160
166
The `expression` can be any angular expression (assignable expression where so specified). All expressions are evaluated once at the time when the scroller is initialized. Changes in the expression value after scroller initialization will have no impact on the scroller behavior.
161
167
162
-
The assignable expressions will be used by scroller to inject the requested value into the target scope. The scope associated with the viewport (the element marked with the [uiScrollViewport](#uiscrollviewport-directive) directive) will be used as the target scope. If the viewport is not defined (window viewport), the $rootScope will be used as the target scope. Note that the nearest additional scope-wrapper (like ng-if directive set right on the viewport) makes this mechanism unusable. There are two options which help in this case:
163
-
164
-
1. The second format `expression on controller` can be used to explicitly target the scope associated with the specified controller as the target scope for the injection. In this format `expression` is any angular assignable expression, and `controller` is the name of controller constructor function as specified in the `ng-controller` directive. The scroller will traverse its parents to locate the target scope associated with the specified controller.
165
-
166
-
2. Also `Controller As` syntax could be used as an alternative way to specify target controller in assignable expressions.
167
-
168
+
The assignable expressions will be used by scroller to inject the requested value into the target scope. The scope associated with the viewport (the element marked with the [uiScrollViewport](#uiscrollviewport-directive) directive) will be used as the target scope. If the viewport is not defined (window viewport), the $rootScope will be used as the target scope. Also `Controller As` syntax could be used as an alternative way to specify target controller in assignable expressions.
168
169
169
170
### Datasource
170
171
@@ -186,7 +187,8 @@ The data source object implements methods and properties to be used by the direc
186
187
get(index, count, success)
187
188
188
189
This is a mandatory method used by the directive to retrieve the data.
189
-
#### Parameters
190
+
191
+
Parameters
190
192
***descriptor** is an object defining the portion of the dataset requested. The object will have 3 properties. Two of them named `index` and `count`. They have the same meaning as in the alternative signature when the parameters passed explicitly (see below). The third one will be named either `append` if the items will be appended to the last item in the buffer, or `prepend` if they are to be prepended to the first item in the buffer. The value of the property in either case will be the item the new items will be appended/prepended to. This is useful if it is easier to identify the items to be added based on the previously requested items rather than on the index. Keep in mind that in certain use cases (i.e. on initial load) the value of the append/prepend property can be undefined.
191
193
***index** indicates the first data row requested
192
194
***count** indicates number of data rows requested
@@ -204,7 +206,7 @@ exactly `count` elements unless it hit eof/bof.
204
206
205
207
###Adapter
206
208
207
-
The adapter object is an internal object created for every instance of the scroller. Properties and methods of the adapter can be used to manipulate and assess the scroller the adapter was created for. Adapter based API replaces old (undocumented) event based API introduced earlier for this purpose. The event based API is now deprecated and no longer supported.
209
+
The adapter object is an internal object created for every instance of the scroller. Properties and methods of the adapter can be used to manipulate and assess the scroller the adapter was created for.
208
210
209
211
Adapter object implements the following properties:
210
212
@@ -250,30 +252,34 @@ Adapter object implements the following methods
250
252
applyUpdates(index, newItems)
251
253
252
254
Replaces the item in the buffer at the given index with the new items.
253
-
#### Parameters
255
+
256
+
Parameters
254
257
***index** provides position of the item to be affected in the dataset (not in the buffer). If the item with the given index currently is not in the buffer no updates will be applied. `$index` property of the item $scope can be used to access the index value for a given item
255
258
***newItems** is an array of items to replace the affected item. If the array is empty (`[]`) the item will be deleted, otherwise the items in the array replace the item. If the newItem array contains the old item, the old item stays in place.
256
259
257
260
applyUpdates(updater)
258
261
259
262
Updates scroller content as determined by the updater function
260
-
#### Parameters
263
+
264
+
Parameters
261
265
***updater** is a function to be applied to every item currently in the buffer. The function will receive 3 parameters: `item`, `scope`, and `element`. Here `item` is the item to be affected, `scope` is the item $scope, and `element` is the html element for the item. The return value of the function should be an array of items. Similarly to the `newItem` parameter (see above), if the array is empty(`[]`), the item is deleted, otherwise the item is replaced by the items in the array. If the return value is not an array, the item remains unaffected, unless some updates were made to the item in the updater function. This can be thought of as in place update.
262
266
263
267
* Method `append`
264
268
265
269
append(newItems)
266
270
267
271
Adds new items after the last item in the buffer.
268
-
#### Parameters
272
+
273
+
Parameters
269
274
***newItems** provides an array of items to be appended.
270
275
271
276
* Method `prepend`
272
277
273
278
prepend(newItems)
274
279
275
280
Adds new items before the first item in the buffer.
276
-
#### Parameters
281
+
282
+
Parameters
277
283
***newItems** provides an array of items to be prepended.
278
284
279
285
#### Manipulating the scroller content with adapter methods
@@ -433,12 +439,16 @@ PR should include source code (./scr) and tests (./test) changes and may not inc
0 commit comments