Created
September 23, 2019 19:52
-
-
Save fhdez/34ed117d17b97302f7c5485ca8b78128 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hasElement(item){ | |
return item !== undefined && item !== null && item !== ''; | |
} | |
function updateAnswers() { | |
imagen1 = angular.element('#id_imagen1').val(); | |
imagen2 = angular.element('#id_imagen2').val(); | |
imagen3 = angular.element('#id_imagen3').val(); | |
imagen4 = angular.element('#id_imagen4').val(); | |
image_answers = [imagen1, imagen2, imagen3, imagen4]; | |
text_answers = [$scope.respuesta1, $scope.respuesta2, $scope.respuesta3, $scope.respuesta4]; | |
content_text = text_answers.every(function(item) { return item !== undefined && item !== null && item !== ''; }); | |
content_image = image_answers.every(function(item) { return item !== undefined && item !== null && item !== ''; }); | |
$scope.hasImages = image_answers.some(hasElement); | |
$scope.hasTexts = text_answers.some(hasElement); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment