Hi
I have navigation build into my app via left, right, & up html buttons but would ideally like to use swipe gestures. Looking through the docs I have found things like on-swipe-right
but can’t get this to work. All I want to do is have the on-swipe-right gesture ‘click’ on the next link (which is already generated). Something like this doesn’t seem to be working,
<button on-swipe-right="onSwipeRight()" class="button"><a href="#/tab/image/1"</a></button>
Thanks
thefoxbrain:
onSwipeRight
Would be nice to see what your onSwipeRight function does.
onSwipeRight has to do something like: $location.path(‘/tab/image/1’) or $state.go …
greetz.
Ahh, thanks for that very useful. I need to put together a function to call the link. I will post it back here once I have it working
I’ve put this together but I can’t get it to work. All I want it to do is pass through a url path and then open it.
.controller("CtrlRouteUrl", function ($scope, $location, path) {
$scope.onSwipeRight = function () {
$location.path(path);
$scope.$apply();
};
})
With trying to call it like this. I am testing this in a browser, maybe this is the issue as it doesn’t cope with swipe gestures?
<button on-swipe-right="onSwipeRight(#/tab//event/1)" class="button">test</button>
if you want to pass a url to a controller function you have to write a string in single quotes
i think you do not need to pass the ‘#’ … it is automatically attached during routing
you have to say the controller function that it gets a parameter
on-swipe-right=“onSwipeRight(’/tab//event/1’)”
.controller("CtrlRouteUrl", function ($scope, $location) {
$scope.onSwipeRight = function (path) {
$location.path(path);
};})