Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228603

Next/Prev Item in ng-repeat (change dynamic link?)

$
0
0

Here is the solution in this situation:
var n = 0;
var next_item = "";

//act_url = :todoID (actual url)
var act_url = $stateParams.todoId;

//Actual item [key]
angular.forEach(TodosService.todos, function(todo, key) {
  if (todo.id === act_url) {
    n = key;
  }
})

//next button
$scope.next = function (){
  n = n + 1 ;
  next_item = TodosService.todos[n];
  $state.go('todo', { todoId: next_item.id });
  }
})

Viewing all articles
Browse latest Browse all 228603

Trending Articles