javascript - angular splice overwriting element on move fromIndex, toIndex -
i have array exposed $scope called exercises containing array of exercises objects this:
[ { "exercisename": "half lunge ", "exercisedescription": "stand 1 foot forward taking of weight.", "images": [71,73] } ] i aim move exercise 1 position using following:
$scope.moveitem = function(exercise, fromindex, toindex) { $scope.exercises.splice(fromindex, 1); $scope.exercises.splice(toindex, 0, exercise); }; however overwriting exercise in toindex data fromindex
you passing 1 perameter in function. remove exercises perameter element.
<ion-reorder-button class="ion-navicon" on-reorder="moveitem(exercise, $fromindex, $toindex)"></ion-reorder-button> edited codepen
Comments
Post a Comment