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
@@ -142,29 +148,31 @@ It is empty since it was deprecated in v1.6.0.
142
148
>{{item}}</div>
143
149
```
144
150
145
-
### Parametrs
151
+
### Parameters
146
152
147
153
***uiScroll – scroll expression** – The expression indicating how to enumerate a collection. Only one format is currently supported: `variable in datasource` – where variable is the user defined loop variable and datasource is the name of the data source to enumerate.
148
-
***buffer-size - expression**, optional - number of items requested from the datasource in a single request. The default is 10 and the minimal value is 3
149
-
***padding - expression**, optional - extra height added to the visible area for the purpose of determining when the items should be created/destroyed. The value is relative to the visible height of the area, the default is 0.5 and the minimal value is 0.3
154
+
***buffer-size - expression**, optional - number of items requested from the datasource in a single request. The default is 10 and the minimal value is 3.
155
+
***padding - expression**, optional - extra height added to the visible area for the purpose of determining when the items should be created/destroyed. The value is relative to the visible height of the area, the default is 0.5 and the minimal value is 0.3.
150
156
***start-index - expression**, optional - index of the first item to be requested from the datasource. The default is 1.
151
157
***adapter - assignable expression**, optional - if provided a reference to the adapter object for the scroller instance will be injected in the appropriate scope. If you have multiple scrollers within the same viewport, make sure that every one of them has its unique adapter name.
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.
168
+
The `assignable expressions` will be used by scroller to inject the requested value into the target scope.
169
+
The target scope is being defined in accordance with standard Angular rules (nested scopes and controller As syntax should be taken into account):
170
+
the scroller will traverse its parents (from the ui-scroll element's scope up to the $rootScope) to locate the target scope.
171
+
If the viewport is presented (the element marked with the [uiScrollViewport](#uiscrollviewport-directive) directive),
172
+
then the scope associated with the viewport will be a start point in the target scope locating.
173
+
Angular $parse service is being used in `assignable expressions` implementation.
167
174
175
+
_Deprecated!_ The format `expression on controller` introduced in v1.5.0 (and deprecated in v1.6.1) 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.
168
176
169
177
### Datasource
170
178
@@ -186,7 +194,8 @@ The data source object implements methods and properties to be used by the direc
186
194
get(index, count, success)
187
195
188
196
This is a mandatory method used by the directive to retrieve the data.
189
-
#### Parameters
197
+
198
+
Parameters
190
199
***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
200
***index** indicates the first data row requested
192
201
***count** indicates number of data rows requested
@@ -204,7 +213,7 @@ exactly `count` elements unless it hit eof/bof.
204
213
205
214
###Adapter
206
215
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.
216
+
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
217
209
218
Adapter object implements the following properties:
210
219
@@ -250,30 +259,34 @@ Adapter object implements the following methods
250
259
applyUpdates(index, newItems)
251
260
252
261
Replaces the item in the buffer at the given index with the new items.
253
-
#### Parameters
262
+
263
+
Parameters
254
264
***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
265
***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
266
257
267
applyUpdates(updater)
258
268
259
269
Updates scroller content as determined by the updater function
260
-
#### Parameters
270
+
271
+
Parameters
261
272
***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
273
263
274
* Method `append`
264
275
265
276
append(newItems)
266
277
267
278
Adds new items after the last item in the buffer.
268
-
#### Parameters
279
+
280
+
Parameters
269
281
***newItems** provides an array of items to be appended.
270
282
271
283
* Method `prepend`
272
284
273
285
prepend(newItems)
274
286
275
287
Adds new items before the first item in the buffer.
276
-
#### Parameters
288
+
289
+
Parameters
277
290
***newItems** provides an array of items to be prepended.
278
291
279
292
#### Manipulating the scroller content with adapter methods
@@ -390,7 +403,7 @@ The ui-scroll sources are in [./src](https://github.com/angular-ui/ui-scroll/tre
390
403
because of ES6 modules (since v1.6.0), they should be built. Build process includes jshint sources verification, webpack-based
391
404
distributive files forming and tests running.
392
405
393
-
Three npm scripts are available for developing.
406
+
There are some npm scripts available for developing.
394
407
395
408
__1__. To run dev-server use
396
409
@@ -410,35 +423,48 @@ npm test
410
423
```
411
424
412
425
This runs karma testing against temporary distributive files (./temp). We created a number of specifications which consist of more
413
-
than 160 tests. They are living at [./test](https://github.com/angular-ui/ui-scroll/tree/master/test) folder. Karma watches for temp
414
-
and test folders changes and automatically re-run tests.
426
+
than 160 tests. They are living at the [./test](https://github.com/angular-ui/ui-scroll/tree/master/test) folder. Karma watches for temp
427
+
and test folders changes and automatically re-runs tests.
428
+
429
+
__3__. To run both dev-server and tests in keep-alive mode use
415
430
416
-
__3__. To run full build use
431
+
```
432
+
npm run dev
433
+
```
434
+
435
+
This is the combination of first two scripts running in concurrently mode. This allows you to work with the ui-scroll examples on 5005 port
436
+
during continuous tests running.
437
+
438
+
__4__. To run full build process use
417
439
418
440
```
419
441
npm run build
420
442
```
421
443
422
-
After developing and testing complete the build process should be run to
444
+
After developing and testing complete, the build process should be run to
423
445
a) pass through jshint,
424
446
b) generate minified versions of distributive,
425
447
c) run tests with minified distributive files,
426
-
d) obtain all necessary files in [./dist](https://github.com/angular-ui/ui-scroll/tree/master/dist) folder.
448
+
d) obtain all necessary files in the [./dist](https://github.com/angular-ui/ui-scroll/tree/master/dist) folder.
427
449
428
-
PR should include source code (./scr) and tests (./test) changes and may not include public distributive (./dist) changes.
450
+
PR should include source code (./scr) changes, may include tests (./test) changes and may not include public distributive (./dist) changes.
* Removed 'ui.scroll.jqlite' module. Added jqLiteExtras service to 'ui.scroll' module.
441
-
* Significantly changed readme.
467
+
* Significantly changed the README.
442
468
443
469
###v1.5.2
444
470
* Refactored assignable expressions and attributes scope bindings.
@@ -481,21 +507,21 @@ PR should include source code (./scr) and tests (./test) changes and may not inc
481
507
###v1.3.0
482
508
* Reorganized the repository structure.
483
509
484
-
####v1.2.1
510
+
###v1.2.1
485
511
* Dismiss pending requests on applyUpdates().
486
512
487
-
####v1.2.0
513
+
###v1.2.0
488
514
* Changed the algorithm of list items building.
489
515
* Integration with angular $animation.
490
516
* Insert/update/delete events are no longer supported.
491
517
492
-
####v1.1.2
518
+
###v1.1.2
493
519
* Fixed inserting elements via applyUpdates error.
494
520
495
-
####v1.1.1
521
+
###v1.1.1
496
522
* Fixed jqlite on $destroy error.
497
523
498
-
####v1.1.0
524
+
###v1.1.0
499
525
* Introduced API to dynamically update scroller content.
500
526
* Deep 'name' properties access via dot-notation in template.
501
527
* Fixed the problem occurring if the scroller is $destroyed while there are requests pending: [#64](https://github.com/Hill30/NGScroller/issues/64).
0 commit comments