title: Comparing two arrays which contain objects
body: <p>I have two arrays which only contain objects for groups. One contains all the groups on my site. The other contains all the groups a specific user belongs to. </p>
  
  <p>I'd like to subtract: <code>All the groups</code> - <code>user groups</code>  = <code>groups remaining</code></p>
  
  <p>I'm using AngularJS, I'm not sure if that helps here or not (maybe a filter could be used). </p>
  
  <p>I looked at previous questions and came across some options: </p>
  
  <p>These are the ones I tried: </p>
  
  <pre><code>$scope.availableGroups =  $($scope.groups).not($scope.assignedGroups).get();
  $scope.availableGroups = $.grep($scope.groups,function(x) {return $.inArray(x, $scope.assignedGroups) &lt; 0})
  </code></pre>
  
  <p>This is one of the arrays: </p>
  
  <p>assignedGroups: </p>
  
  <pre><code>[{
      id: 115,
      name: 'Test Group 2',
      Description: '',
      owner: 10,
      OwnerIsUser: false,
  }, {
      id: 116,
      name: 'Test Group 3',
      Description: '',
      owner: 71,
      OwnerIsUser: false,
  }, {
      id: 117,
      name: 'Test Group 4',
      Description: '',
      owner: 71,
      OwnerIsUser: false,
  }, {
      id: 118,
      name: 'Test Group 5',
      Description: '',
      owner: 115,
      OwnerIsUser: false,
  }, {
      id: 119,
      name: 'Test Group 6',
      Description: '',
      owner: 8,
      OwnerIsUser: true,
  }];
  </code></pre>