I'm sending a form that has two alternatives to post, If one option is filled the second one needs to be empty.
on submit I send it to a function that its first line is check
function to verify that everything as expected :
fc.check = () => {
fc.first ? fc.a = fc.b = [] : fc.first = null;
}
Then I have a validation before the rest of the actions :
if($scope.form.$valid) ...
The weird part happens when I console log $valid
attribute and the form object and get both true and false:
By the way, using any setTimeout
or clicking the button again is giving the expected results, which makes me think the object is not updated at time.
Any idea how should I figure it out?