mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(ionScroll): add has-bouncing=true/false attribute
Closes #1573. Closes #1367.
This commit is contained in:
3
js/angular/directive/scroll.js
vendored
3
js/angular/directive/scroll.js
vendored
@@ -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', [
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user