Call a controller method in $ionicGesture

How can i call a contoller method when swipe is triggered.
something like this

.directive('swiped', ['$ionicGesture', function($ionicGesture) {

return {
    restrict: 'A',
    link: function($scope, $element, $attr) {
        console.log($scope, $element, $attr);
        $ionicGesture.on('swipe', function(e) {
           //call the controller method
        },$element);
    }
}

}]);

1 Like

Thanks I just had to do this

.directive('swiped', ['$ionicGesture', function($ionicGesture) {

return {
    restrict: 'A',
    link: function($scope, $element, $attr) {
         var scope=$scope;
        console.log($scope, $element, $attr);
        $ionicGesture.on('swipe', function(e) {
          scope.methodnam();
        },$element);
    }
}
}]);