State Change Triggered by Swipe:
I am trying to change the state of my application using a swipe event. I have looked at the ui-router documentation which suggests using $state.go()
, but I'm not sure if this is the best approach?
QUESTION:
How can I use ng-swipe
events to trigger a $state.go()
with parameters? Is there a better way to achieve this?
The state I am working with is:
name: 'root.store.ad.page.pageNumber', 'url': '/:pageNumber'
When swiping an li
element, ideally it would be like this (but not necessary):
<li ng-swipe-left="root.store.ad.page.pageNumber({pageNumber: nextPage})"></li>
Currently it looks like this :
<li ng-swipe-right="setPage(page.pageindex)"></li>
I have attempted to use $state.go() but I am facing difficulties in passing parameters.
ERROR:
CTRL:
scope.setPage = function(val){
//trying to make it just jump to page 5.
$state.go('root.store.ad.page.pageNumber',
{
pageNumber: 5,
}
);
};