Skip to content

Instantly share code, notes, and snippets.

@fhdez
Created September 23, 2019 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fhdez/34ed117d17b97302f7c5485ca8b78128 to your computer and use it in GitHub Desktop.
Save fhdez/34ed117d17b97302f7c5485ca8b78128 to your computer and use it in GitHub Desktop.
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