How to concat two lists of objects into one list
var list_1 = [
{id: 13205, name:'Allan', firstName:'jake'},
{id: 13210, name:'Douglas', firstName:'jordan'}
]
var list_2 = {13205: [{label:'type', sections: [{label: 'position'}]}]}
I would like to keep the list "list_1" by integrating the list_2 if they are the same id and that in a subobject "categories" like this :
var list_1 = [
{id: 13205, name:'Allan', firstName:'jake', categories : [{label:'type',
sections: [{label: 'position'}]}] },
{id: 13210, name:'Douglas', firstName:'jordan'}
]
I used ES5 and AngularJs
If you have a solution ?
Thank you in advance for your answer