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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -