Following solution will be worked well when am using lambda function.due to some karma test case failure i have to avoid lambda function in sorting.i don't know how to overcome this issue.now the following code is not working for me
var test=[{ID: "91",Name: "sgtue", standardID: "1"},
{ID: "41",Name: "asdfasdf", standardID: "2"},
{ID: "5", Name: "credd", standardID: "2"},
{ID: "2",Name: "dddawer", standardID: "2"},
{ID: "2",Name: "dsfadf", standardID: "3"},
{ID: "275", Name: "xcvcvc", standardID: "201"}
];
var groupOrder = [1,3,2,201];
var testSorted = test.sort(function (a, b) {groupOrder.indexOf(parseInt(a.standardID))-groupOrder.indexOf(parseInt(b.standardID))});
console.log(testSorted);
The same concept will be working on the following link: fiddle working link
And following link is my actual question: How do we customize the grouping from actual array of objects in angularjs
var testSorted = test.sort((a, b) => parseInt(a.standardID)-parseInt(b.standardID));?