javascript - Angularjs check if two arrays have different elements -
i have array $scope.blinkingboxes=[1,3,2]
i have array called $scope.clickedboxes
, push few values in it.
now if(angular.equals($scope.blinkingboxes, $scope.clickedboxes)){dosomething()}
checks if both arrays same (i.e. same elements in same order)
however want check if second array not contain element first array , perform action. how can achieve this?
there no such built-in function
you can use
angular.foreach(array1, function(value, key) { angular.foreach(array2, function(value_1, key_1) { if (value === value_1) { // condition or action } });
});
Comments
Post a Comment