Call a controller method in $ionicGesture


#1

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);
    }
}

}]);


#2

#3

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);
    }
}
}]);

#4