I am trying to toggle css class on input if validation is valid, i can do if is invalid, but i need two classes if is valid and if is not. Is it easy to make it if is not valid, but how to add if is valid, here is my code i have for now:
<form name="userForm" ng-submit="submitForm()" novalidate>
<input type="email" name="email" placeholder="E-mailadres" class="input-field" ng-model="user.email" required ng-class="{ 'has-error' : userForm.email.$invalid && !userForm.email.$pristine }" />
<p ng-show="userForm.email.$invalid && !userForm.email.$pristine" class="help-block">Enter a valid email.</p>
<input type="password" name="password" ng-model="user.password" placeholder="Wachtwoord" class="input-field" required />
<p ng-show="userForm.password.$invalid && !userForm.password.$pristine" class="help-block">You name is required.</p>
<button type="submit" class="btn hit-btn" ng-disabled="userForm.$invalid">Log in</button>
</form>
You will notice that i have class has-error but i need also class no-error