@@ -707,56 +707,58 @@ angular.module('ionic.ui.content', [])
707707
708708
709709 // Otherwise, supercharge this baby!
710- sv = new ionic . views . Scroll ( {
711- el : $element [ 0 ] ,
712- scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
713- scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
714- scrollingX : $scope . $eval ( $scope . hasScrollX ) == true ,
715- scrollingY : $scope . $eval ( $scope . hasScrollY ) !== false ,
716- scrollEventInterval : parseInt ( $scope . scrollEventInterval , 10 ) || 20 ,
717- scrollingComplete : function ( ) {
718- $scope . onScrollComplete ( {
719- scrollTop : this . __scrollTop ,
720- scrollLeft : this . __scrollLeft
710+ $timeout ( function ( ) {
711+ sv = new ionic . views . Scroll ( {
712+ el : $element [ 0 ] ,
713+ scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
714+ scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
715+ scrollingX : $scope . $eval ( $scope . hasScrollX ) == true ,
716+ scrollingY : $scope . $eval ( $scope . hasScrollY ) !== false ,
717+ scrollEventInterval : parseInt ( $scope . scrollEventInterval , 10 ) || 20 ,
718+ scrollingComplete : function ( ) {
719+ $scope . onScrollComplete ( {
720+ scrollTop : this . __scrollTop ,
721+ scrollLeft : this . __scrollLeft
722+ } ) ;
723+ }
724+ } ) ;
725+
726+ // Activate pull-to-refresh
727+ if ( refresher ) {
728+ sv . activatePullToRefresh ( 50 , function ( ) {
729+ refresher . classList . add ( 'active' ) ;
730+ } , function ( ) {
731+ refresher . classList . remove ( 'refreshing' ) ;
732+ refresher . classList . remove ( 'active' ) ;
733+ } , function ( ) {
734+ refresher . classList . add ( 'refreshing' ) ;
735+ $scope . onRefresh ( ) ;
736+ $scope . $parent . $broadcast ( 'scroll.onRefresh' ) ;
721737 } ) ;
722738 }
723- } ) ;
724739
725- // Activate pull-to-refresh
726- if ( refresher ) {
727- sv . activatePullToRefresh ( 50 , function ( ) {
728- refresher . classList . add ( 'active' ) ;
729- } , function ( ) {
730- refresher . classList . remove ( 'refreshing' ) ;
731- refresher . classList . remove ( 'active' ) ;
732- } , function ( ) {
733- refresher . classList . add ( 'refreshing' ) ;
734- $scope . onRefresh ( ) ;
735- $scope . $parent . $broadcast ( 'scroll.onRefresh' ) ;
740+ $element . bind ( 'scroll' , function ( e ) {
741+ $scope . onScroll ( {
742+ event : e ,
743+ scrollTop : e . detail ? e . detail . scrollTop : e . originalEvent ? e . originalEvent . detail . scrollTop : 0 ,
744+ scrollLeft : e . detail ? e . detail . scrollLeft : e . originalEvent ? e . originalEvent . detail . scrollLeft : 0
745+ } ) ;
736746 } ) ;
737- }
738747
739- $element . bind ( 'scroll' , function ( e ) {
740- $scope . onScroll ( {
741- event : e ,
742- scrollTop : e . detail ? e . detail . scrollTop : e . originalEvent ? e . originalEvent . detail . scrollTop : 0 ,
743- scrollLeft : e . detail ? e . detail . scrollLeft : e . originalEvent ? e . originalEvent . detail . scrollLeft : 0
748+ $scope . $parent . $on ( 'scroll.resize ' , function ( e ) {
749+ // Run the resize after this digest
750+ $timeout ( function ( ) {
751+ sv && sv . resize ( ) ;
752+ } )
744753 } ) ;
745- } ) ;
746-
747- $scope . $parent . $on ( 'scroll.resize' , function ( e ) {
748- // Run the resize after this digest
749- $timeout ( function ( ) {
750- sv && sv . resize ( ) ;
751- } )
752- } ) ;
753754
754- $scope . $parent . $on ( 'scroll.refreshComplete' , function ( e ) {
755- sv && sv . finishPullToRefresh ( ) ;
755+ $scope . $parent . $on ( 'scroll.refreshComplete' , function ( e ) {
756+ sv && sv . finishPullToRefresh ( ) ;
757+ } ) ;
758+
759+ // Let child scopes access this
760+ $scope . $parent . scrollView = sv ;
756761 } ) ;
757-
758- // Let child scopes access this
759- $scope . $parent . scrollView = sv ;
760762
761763
762764
@@ -1627,49 +1629,51 @@ angular.module('ionic.ui.scroll', [])
16271629 var hasScrollingX = $scope . direction . indexOf ( 'x' ) >= 0 ;
16281630 var hasScrollingY = $scope . direction . indexOf ( 'y' ) >= 0 ;
16291631
1630- sv = new ionic . views . Scroll ( {
1631- el : $element [ 0 ] ,
1632- scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
1633- scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
1634- scrollingX : hasScrollingX ,
1635- scrollingY : hasScrollingY
1636- } ) ;
1637-
1638- // Activate pull-to-refresh
1639- if ( refresher ) {
1640- sv . activatePullToRefresh ( refresherHeight , function ( ) {
1641- refresher . classList . add ( 'active' ) ;
1642- } , function ( ) {
1643- refresher . classList . remove ( 'refreshing' ) ;
1644- refresher . classList . remove ( 'active' ) ;
1645- } , function ( ) {
1646- refresher . classList . add ( 'refreshing' ) ;
1647- $scope . onRefresh ( ) ;
1648- $scope . $parent . $broadcast ( 'scroll.onRefresh' ) ;
1632+ $timeout ( function ( ) {
1633+ sv = new ionic . views . Scroll ( {
1634+ el : $element [ 0 ] ,
1635+ scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
1636+ scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
1637+ scrollingX : hasScrollingX ,
1638+ scrollingY : hasScrollingY
16491639 } ) ;
1650- }
16511640
1652- $element . bind ( 'scroll' , function ( e ) {
1653- $scope . onScroll ( {
1654- event : e ,
1655- scrollTop : e . detail ? e . detail . scrollTop : e . originalEvent ? e . originalEvent . detail . scrollTop : 0 ,
1656- scrollLeft : e . detail ? e . detail . scrollLeft : e . originalEvent ? e . originalEvent . detail . scrollLeft : 0
1641+ // Activate pull-to-refresh
1642+ if ( refresher ) {
1643+ sv . activatePullToRefresh ( refresherHeight , function ( ) {
1644+ refresher . classList . add ( 'active' ) ;
1645+ } , function ( ) {
1646+ refresher . classList . remove ( 'refreshing' ) ;
1647+ refresher . classList . remove ( 'active' ) ;
1648+ } , function ( ) {
1649+ refresher . classList . add ( 'refreshing' ) ;
1650+ $scope . onRefresh ( ) ;
1651+ $scope . $parent . $broadcast ( 'scroll.onRefresh' ) ;
1652+ } ) ;
1653+ }
1654+
1655+ $element . bind ( 'scroll' , function ( e ) {
1656+ $scope . onScroll ( {
1657+ event : e ,
1658+ scrollTop : e . detail ? e . detail . scrollTop : e . originalEvent ? e . originalEvent . detail . scrollTop : 0 ,
1659+ scrollLeft : e . detail ? e . detail . scrollLeft : e . originalEvent ? e . originalEvent . detail . scrollLeft : 0
1660+ } ) ;
16571661 } ) ;
1658- } ) ;
16591662
1660- $scope . $parent . $on ( 'scroll.resize' , function ( e ) {
1661- // Run the resize after this digest
1662- $timeout ( function ( ) {
1663- sv && sv . resize ( ) ;
1664- } )
1665- } ) ;
1663+ $scope . $parent . $on ( 'scroll.resize' , function ( e ) {
1664+ // Run the resize after this digest
1665+ $timeout ( function ( ) {
1666+ sv && sv . resize ( ) ;
1667+ } )
1668+ } ) ;
16661669
1667- $scope . $parent . $on ( 'scroll.refreshComplete' , function ( e ) {
1668- sv && sv . finishPullToRefresh ( ) ;
1670+ $scope . $parent . $on ( 'scroll.refreshComplete' , function ( e ) {
1671+ sv && sv . finishPullToRefresh ( ) ;
1672+ } ) ;
1673+
1674+ // Let child scopes access this
1675+ $scope . $parent . scrollView = sv ;
16691676 } ) ;
1670-
1671- // Let child scopes access this
1672- $scope . $parent . scrollView = sv ;
16731677 } ;
16741678 }
16751679 } ;
0 commit comments