Skip to content

Commit 00c80e8

Browse files
committed
feat(ionScroll): add has-bouncing=true/false attribute
Closes #1573. Closes #1367.
1 parent f5f5851 commit 00c80e8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

js/angular/directive/scroll.js

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* @param {boolean=} zooming Whether to support pinch-to-zoom
2020
* @param {integer=} min-zoom The smallest zoom amount allowed (default is 0.5)
2121
* @param {integer=} max-zoom The largest zoom amount allowed (default is 3)
22+
* @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges
23+
* of the content. Defaults to true on iOS, false on Android.
2224
*/
2325
IonicModule
2426
.directive('ionScroll', [
@@ -70,6 +72,7 @@ function($timeout, $controller, $ionicBind) {
7072
var scrollViewOptions= {
7173
el: $element[0],
7274
delegateHandle: $attr.delegateHandle,
75+
bouncing: $scope.$eval($attr.hasBouncing),
7376
paging: isPaging,
7477
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
7578
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,

test/unit/angular/directive/scroll.unit.js

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ describe('Ionic Scroll Directive', function() {
2020
.toBe('handleThis');
2121
});
2222

23+
it('passes hasBouncing attribute', function() {
24+
var el = compile('<ion-scroll has-bouncing="123">')(scope);
25+
expect(el.controller('$ionicScroll')._scrollViewOptions.bouncing).toEqual(123);
26+
});
27+
2328
it('has $onScroll (used by $ionicScrollController)', function() {
2429
element = compile('<ion-scroll on-scroll="foo()"></ion-scroll>')(scope);
2530
scope = element.scope();

0 commit comments

Comments
 (0)