I am working on a button and trying to shake it on clicking it if the form fields above it are invalid.
Here is my code for the controller :-
if(valid){.. do valid stuff here ..}
else{
console.log(this.shakeNotValid);
// SHAKE ANIMATION
this.shakeNotValid = true;
$timeout(function() {
this.shakeNotValid = false;
} , 500);
}
No where else is this.shakeNotValid is defined or assigned.
The console line returns me undefined for the first time and the button shakes but subsequently it keeps returning me true again and again and doesnt shake.
In the html I am assigning a class to the button like this :-
<div ng-click="main.mClick()"
ng-class="{isDisabled: !main.isValidContact && main.showContactCard,
isShaking: main.shakeNotValid}">
What I want is that this button can shake multiple times until all becomes valid as and when the user clicks.
Some help please, thanks !