角度js中两个$ scope数组的差异

Hma*_*ish 3 arrays scope angularjs

有没有办法返回angularjs中作用域中存在的两个数组之间的差异

例如,

 $scope.user1 = ['a', 'b'];
 $scope.user2 = ['a', 'b', 'c', 'd'];
Run Code Online (Sandbox Code Playgroud)

这两个的区别应该给我另一个$ scope.user3 = ['c','d']

ric*_*ick 10

Underscore.js有不同的方法.

http://underscorejs.org/#difference

$scope.user1 = ['a', 'b'];
$scope.user2 = ['a', 'b', 'c', 'd'];
$scope.user3 = _.difference($scope.user2, $scope.user1);
Run Code Online (Sandbox Code Playgroud)