could you please tell me how delegate-handle work in ionic actually I make a demo in code pen .I want to scroll the contend to top when button click .But my code is not working when I scroll my contend and then press button but my scroll not goes to top why ? http://codepen.io/anon/pen/wavoXb
var app=angular.module('app',['ionic']);
app.controller('MainCtrl',function($scope){
$scope.scrollMainToTop = function() {
$ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();
};
$scope.scrollSmallToTop = function() {
$ionicScrollDelegate.$getByHandle('small').scrollTop();
};
})
You need to inject $ionicScrollDelegate in the controller.
app.controller('MainCtrl',function($scope,$ionicScrollDelegate){
$scope.scrollMainToTop = function() {
$ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();
};
$scope.scrollSmallToTop = function() {
$ionicScrollDelegate.$getByHandle('small').scrollTop();
};