Sunday, September 24, 2017

How do we customize the grouping from actual array of objects in angularjs

i have to create my customized grouping order based on using standardID in the following array of objects
Actual Array:

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"}
    ]

Expected Result:Simply i want to group like 1,3,2,2,2,201

[{ID: "91",Name: "sgtue", standardID: "1"},
{ID: "2",Name: "dsfadf", standardID: "3"},
{ID: "275", Name: "xcvcvc", standardID: "201"}
{ID: "41",Name: "asdfasdf", standardID: "2"}
{ID: "5", Name: "credd", standardID: "2"}
{ID: "2",Name: "dddawer", standardID: "2"}
}
]

Kindly help me to sort out the problem

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/24/how-do-we-customize-the-grouping-from-actual-array-of-objects-in-angularjs/
via @lzomedia #developer #freelance #web

No comments:

Post a Comment