Sidemenu transitions $watch doesnt work as expected


#1

Hi everyone,

I am trying to customize the ionic sidemenu to add various transitions to it. To do so, I need to retrieve the OpenRatio from the sideMenuController but when I try to get the value while the sideMenu switch in or out, it doesn’t trigger the function.

Here’s the directive that I am trying :

App.directive('sideAlong', function($timeout) {
  return {
    link: function($scope, $element, $attrs) {
      $timeout(function(){
        $scope.$watch('sideMenuController.getOpenRatio()', function(ratio){
           console.log('ratio is : ' + (ratio===undefined) ? '0' : ratio);
        }
      }
    }
  };
});

It’s gets called when the page loads but then nothing.

Any idea how to trigger the directive everytime the ratio changes ?