Error: Zooming is not enabled!

I get this error in console even thoug zooming does happen. So functionality works, it’s just this error message that i get that is making me nervous :slight_smile: I use basic controller code like this:

.controller('MyCtrl', function($scope, $ionicScrollDelegate) {
 
  $scope.zoom= function(){
   
    $ionicScrollDelegate.zoomBy(2.0,true);
   
  }

});

Any idea how to solve this problem?

I also realized just now that I get this message though my zooming works. were you able to figure out the fix for this?

Also I am not able to go back to the default zoom of 1 if I tap again as is the behavior in other apps. Are you able to achieve this?

There can be two reasons for the error -:

  1. You have not included the zooming attribute to the directive like the following

    <ion-scroll zooming=“true” …
    OR

2.| If you are using two or more ionic directives which supports zooming like ion-content and ion-scroll, then you need to call the zoomBy function of that directive for which you have defined the zooming attribute, by using delegate-handle. Please find below the complete example.

HTML

 <ion-content delegate-handle="main">
             <ion-scroll zooming="true" direction="xy" delegate-handle="inner">
              <img on-tap="zoom()" src="" />
             </ion-scroll>
           </ion-content>

JS

        $scope.zoom= function(){
                          $ionicScrollDelegate.$getByHandle('inner').zoomBy(2, true);
          
        }

Hope it helps.
Sukhdeep

1 Like