Skip to content

Commit 62c4b50

Browse files
committed
v1.6.1 readme changes
1 parent ff1fb37 commit 62c4b50

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

README.md

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ It will start retrieving new data for new elements again if the user scrolls up/
6464
### Basic usage
6565

6666
```html
67-
<ANY ui-scroll="{scroll_expression}" buffer-size="value" ... >
67+
<ANY ui-scroll-viewport>
68+
<ANY ui-scroll="items in datasource" ... >
6869
...
70+
</ANY>
6971
</ANY>
7072
```
7173
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
8183
in the datasource. Even if it does not, using the directive this way does not provide any advantages over using ng-repeat, because
8284
item template will be always instantiated for every item in the datasource.
8385

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+
8490

8591
### Examples
8692

@@ -152,19 +158,14 @@ It is empty since it was deprecated in v1.6.0.
152158

153159
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:
154160

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.
159165

160166
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.
161167

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.
168169

169170
### Datasource
170171

@@ -186,7 +187,8 @@ The data source object implements methods and properties to be used by the direc
186187
get(index, count, success)
187188

188189
This is a mandatory method used by the directive to retrieve the data.
189-
#### Parameters
190+
191+
Parameters
190192
* **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.
191193
* **index** indicates the first data row requested
192194
* **count** indicates number of data rows requested
@@ -204,7 +206,7 @@ exactly `count` elements unless it hit eof/bof.
204206

205207
###Adapter
206208

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.
208210

209211
Adapter object implements the following properties:
210212

@@ -250,30 +252,34 @@ Adapter object implements the following methods
250252
applyUpdates(index, newItems)
251253

252254
Replaces the item in the buffer at the given index with the new items.
253-
#### Parameters
255+
256+
Parameters
254257
* **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
255258
* **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.
256259

257260
applyUpdates(updater)
258261

259262
Updates scroller content as determined by the updater function
260-
#### Parameters
263+
264+
Parameters
261265
* **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.
262266

263267
* Method `append`
264268

265269
append(newItems)
266270

267271
Adds new items after the last item in the buffer.
268-
#### Parameters
272+
273+
Parameters
269274
* **newItems** provides an array of items to be appended.
270275

271276
* Method `prepend`
272277

273278
prepend(newItems)
274279

275280
Adds new items before the first item in the buffer.
276-
#### Parameters
281+
282+
Parameters
277283
* **newItems** provides an array of items to be prepended.
278284

279285
#### 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
433439

434440
## Change log
435441

442+
###v1.6.1
443+
* Refactored Adapter assignments logic
444+
* Fixed Chrome Scroll Anchoring enforced feature [bug](https://github.com/angular-ui/ui-scroll/issues/138)
445+
436446
###v1.6.0
437447
* Introduced ES6 modules in the source codes.
438448
* Improved build process with Webpack.
439449
* Added sourcemaps. Fixed dev-server.
440450
* Removed 'ui.scroll.jqlite' module. Added jqLiteExtras service to 'ui.scroll' module.
441-
* Significantly changed readme.
451+
* Significantly changed the README.
442452

443453
###v1.5.2
444454
* Refactored assignable expressions and attributes scope bindings.
@@ -481,21 +491,21 @@ PR should include source code (./scr) and tests (./test) changes and may not inc
481491
###v1.3.0
482492
* Reorganized the repository structure.
483493

484-
####v1.2.1
494+
###v1.2.1
485495
* Dismiss pending requests on applyUpdates().
486496

487-
####v1.2.0
497+
###v1.2.0
488498
* Changed the algorithm of list items building.
489499
* Integration with angular $animation.
490500
* Insert/update/delete events are no longer supported.
491501

492-
####v1.1.2
502+
###v1.1.2
493503
* Fixed inserting elements via applyUpdates error.
494504

495-
####v1.1.1
505+
###v1.1.1
496506
* Fixed jqlite on $destroy error.
497507

498-
####v1.1.0
508+
###v1.1.0
499509
* Introduced API to dynamically update scroller content.
500510
* Deep 'name' properties access via dot-notation in template.
501511
* 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

Comments
 (0)