Wow.This is very difficult for me but thanks :) On Wednesday, March 23, 2016 at 10:41:37 AM UTC+5, Sander Elias wrote: > > Hi Adnan, > > Have a look at this <http://plnkr.co/edit/jeBJ588Vv4Y7PRE8L3K7?p=preview>. > It uses the ES5 reduce and map functions. > > var temp = data.reduce(function(p, c) { //use ES5 reduce to traverse > the array > p[c.TitleId] = p[c.TitleId] || { > TitleId: c.TitleId, > Title: c.Title, > NameId: [], > Name: [] > }; //if it's not defined yet, assign it the structure we need > p[c.TitleId].NameId.push(c.NameId) > p[c.TitleId].Name.push(c.Name) > return p //return the object > }, {}) > // make an array out of the temp object. > var result = Object.keys(temp).map((key) => temp[key]) > > > this.result = result; > } > > > > Regards > Sander >
-- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
