I have a json array which I assign to a $scope object to display at the front-end. I want to rearrange this array on the basis of given id. This is how my initial array looks like.
$scope.listData = [{
id: 1,
name: adam,
title: testing title,
description: testing description
},
{
id: 2,
name: zampa,
title: testing title,
description: testing description
},
{
id: 3,
name: Aaron,
title: testing title,
description: testing description
}]
For rearrangement, For Instance if given id is 3, rearrangement of records should be like 3,1,2.
I have tried using angular.forEach loop, but did not succeed.