JSFiddle - React, Tailwind, and code Playground
by Mikey
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
<div id="app" ng-controller="MainCtrl">
<div data-ng-repeat="item in items">
{{item}}
<!--Move Item Index to the Left-->
<a href="#" ng-click="move($index, $index - 1)"><</a>
<!--Move Item Index to the Right-->
<a href="#" ng-click="move($index, $index + 1)">></a>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('MainCtrl', function ($scope) {
$scope.items = ['a', 'b', 'c'];
$scope.move = function (fromIndex, toIndex) {
var element = $scope.items[fromIndex];
$scope.items.splice(fromIndex, 1);
$scope.items.splice(toIndex, 0, element);
};
});
angular.bootstrap(document.querySelector('#app'), ['myApp']);