Filter an array containing objects based on another array containing objects in angular js
<p>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.</p>

<pre><code>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 = [];
</code></pre>

<p>Now, I wanted to populate the 'newArray' variable with the objects that are not existing in 'old' list as below</p>

<pre><code>newArray = [{id:'2',name:'B'},{id:'4',name:'D'}]
</code></pre>

<p>Is there anyway to achieve this in angular js? Thanks</p>