Skip to content

Commit

Permalink
feat(ionScroll): add has-bouncing=true/false attribute
Browse files Browse the repository at this point in the history
Closes #1573. Closes #1367.
  • Loading branch information
ajoslin committed Jun 4, 2014
1 parent f5f5851 commit 00c80e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/angular/directive/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @param {boolean=} zooming Whether to support pinch-to-zoom
* @param {integer=} min-zoom The smallest zoom amount allowed (default is 0.5)
* @param {integer=} max-zoom The largest zoom amount allowed (default is 3)
* @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges
* of the content. Defaults to true on iOS, false on Android.
*/
IonicModule
.directive('ionScroll', [
Expand Down Expand Up @@ -70,6 +72,7 @@ function($timeout, $controller, $ionicBind) {
var scrollViewOptions= {
el: $element[0],
delegateHandle: $attr.delegateHandle,
bouncing: $scope.$eval($attr.hasBouncing),
paging: isPaging,
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
Expand Down
5 changes: 5 additions & 0 deletions test/unit/angular/directive/scroll.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ describe('Ionic Scroll Directive', function() {
.toBe('handleThis');
});

it('passes hasBouncing attribute', function() {
var el = compile('<ion-scroll has-bouncing="123">')(scope);
expect(el.controller('$ionicScroll')._scrollViewOptions.bouncing).toEqual(123);
});

it('has $onScroll (used by $ionicScrollController)', function() {
element = compile('<ion-scroll on-scroll="foo()"></ion-scroll>')(scope);
scope = element.scope();
Expand Down

0 comments on commit 00c80e8

Please sign in to comment.