I have a function $scope.save(). Here am calling another function $scope.validateFormat()just to validate some value Inside validate function am making one Api call and checking the result if value is valid am returning and allowing the save to save my value. If invalid am setting the value setvalidity as false and throwing error. My doubt here is when i tried to call validateFormat() before completing this function save function is getting complete.
$scope.save() = function(){
// some code
$scope.validateFormat();// calling the validate function
// codde for saving value
}
$scope.validateFormat(){
// some API to get result
if(success){
// some code
}
else{
$scope.filestatus.editFileField.$setValidity("fileField", false);
return false;
}
}