I am trying to utilize () in order to call a function when I swipe down, however, it is not working. I followed the directions provided by the README and I can see that I even have 'angular-swipe' in my bower_ponents. How do I go about fixing this?
Here is how I am calling ng-swipe-down
<div ng-swipe-left="nextImg()" ng-swipe-right="previousImg()" ng-swipe-down="dismissImg()" class="modal-content">
The ng-swipe-left
and ng-swipe-right
work fine. In my dismissImg() I just have an alert() to test.
$scope.dismissImg = function() {
//jQuery to press a esc key
alert("TESTING");
};
I am trying to utilize (https://github./marmorkuchen-net/angular-swipe) in order to call a function when I swipe down, however, it is not working. I followed the directions provided by the README and I can see that I even have 'angular-swipe' in my bower_ponents. How do I go about fixing this?
Here is how I am calling ng-swipe-down
<div ng-swipe-left="nextImg()" ng-swipe-right="previousImg()" ng-swipe-down="dismissImg()" class="modal-content">
The ng-swipe-left
and ng-swipe-right
work fine. In my dismissImg() I just have an alert() to test.
$scope.dismissImg = function() {
//jQuery to press a esc key
alert("TESTING");
};
Share
Improve this question
edited Aug 6, 2014 at 19:00
stcho
asked Aug 6, 2014 at 16:51
stchostcho
2,1693 gold badges31 silver badges45 bronze badges
5
-
Have you listed the module
swipe
as adependency in your app definision? – PSL Commented Aug 6, 2014 at 17:46 - Hi PSL, are you asking about my bower.json file dependencies or some other one? I have only changed the bower.json dependencies. – stcho Commented Aug 6, 2014 at 18:03
- You would need to add it in the angular app declaration as well. SInce it is an angular module that you are going to use – PSL Commented Aug 6, 2014 at 18:08
-
Thanks for your reply PSL. I'm fairly new to angularjs app development. When you say 'angular app declaration' do you mean the
angular.module('myApp', [...])
in my app.js? If so how do I add it? I tried inserting"angular-swipe": "https://github./marmorkuchen-net/angular-swipe.git"
to the last location of the array but it gave me error. – stcho Commented Aug 6, 2014 at 18:19 -
1
angular.module('myApp', ['anydependenciesyouhave','swipe'])..
– PSL Commented Aug 6, 2014 at 18:31
1 Answer
Reset to default 5Angular doesn't provide ng-swipe-down
or ng-swipe-up
directives. Not sure why. (Perhaps because it's too difficult to disentangle swiping from scrolling?) You can double-check this at any time in the ngTouch Docs.
You've found the best solution I know for this: the angular-swipe library, which exists solely to perform this exact function, adding up and down options to ngTouch:
bower install --save 'angular-swipe'
But it's not working for you. Probably because swipe
is not listed as an Angular dependency, in this format:
angular.module('myApp', ['anydependenciesyouhave','swipe'])