I am working on angular js and i am new to it. So I am stuck at a problem where I have to subtract two arrays containing objects.
For Eg.
var all = [{id:'1',name:'A'},{id:'2',name:'B'},{id:'3',name:'C'},{id:'4',name:'D'}];
var old = [{id:'1',name:'A',state:'healthy'},{id:'3',name:'C',state:'healthy'}];
var newArray = [];
Now, I wanted to populate the 'newArray' variable with the objects that are not existing in 'old' list as below
newArray = [{id:'2',name:'B'},{id:'4',name:'D'}]
Is there anyway to achieve this in angular js? Thanks