learning Angular, met another issue in my way, hope anyone can help. I've got one button that must perform two actions: download something and send formdata to the server. So I've wrote this:
<form id='download'>
<label for='name'>Name:</label>
<input type='name' ng-model='nameValue'>
<label for='email'>Email:</label>
<input type='email' id='email' ng-model='emailValue'>
</form>
<a ng-click='sendFormDataIfVal()' href="{{filename}}" download="{{filename}}">Download</a>
But the problem and my question is - now downloading and sending occur simultaneously while I wanna download file only if emailValue pass validation and nameValue is not empty. Suppose it's gonna be something like this, but I dunno how to complete function
$scope.sendFormDataIfVal = function() {
$scope.validateEmail() && $scope.sendFormData(); // download & send
if(!$scope.validateEmail()) {
// do not download and do not send
}
};
Any advise will be greatly... u know :)