angularjs - $ionicScrollDelegate locks the view on the scrolled value -


when i'm getting list of results in cordova app, want roll specified element function:

    $scope.roll = function () {         //var rankscroll = $ionicscrolldelegate.$getbyhandle('rank');          var meelement = document.getelementbyid('scroll');         if (!meelement) {             $ionicscrolldelegate.scrollto(0, 0);             return;         }          var top = meelement.getboundingclientrect().top - 50;         $ionicscrolldelegate.scrollto(0, top);         console.log(top);         console.log($ionicscrolldelegate.getscrollview());      } 

it works nicely, can't scroll other place in list. want unlock scrolling in solution or find better one. should scroll on page loaded, not on click.

all best

that function lock scroll because of $scope's binding.

if want function invoked when view loaded, should call once @ the time view loaded.

you can way in controller:

var roll = function () {     //var rankscroll = $ionicscrolldelegate.$getbyhandle('rank');      var meelement = document.getelementbyid('scroll');     if (!meelement) {         $ionicscrolldelegate.scrollto(0, 0);         return;     }      var top = meelement.getboundingclientrect().top - 50;     $ionicscrolldelegate.scrollto(0, top);     console.log(top);     console.log($ionicscrolldelegate.getscrollview());  } $scope.$on("$ionicview.loaded", function (scopes, states) {     roll(); }); 

you can check more $ionicview events in ion-view document


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -