I'm trying to apply an AngularJs validation in my project. So the following code was written:
<form name="recipeTitle">
<input ng-if="edit" required type="text" ng-model="recipe.name" name="name"/>
</form>
<span>valid = {ng recipeTitle.name.$valid ng}</span>
<span>errors = {ng recipeTitle.name.$error ng}</span>
If no value was entered in input, that returns:
valid = false
errors = {"required":true}
When any value appears in input field, validation returns:
valid = false
errors = {}
And I have no idea, how to make a $valid property become true. Appreciate any help, thanks.