I am having trouble with my login form that displays an error message in a box.
<div class="ui negative message" ng-if="vm.message != ''">
<span ng-bind="vm.message"></span>
</div>
The error message is being set in the controller like this:
LoginService.checkUser(vm.credentials).then(function(res) {
$rootScope.token = res.data.token;
$state.go('home');
}, function(err) {
vm.error = true;
if(err.status == 401){
vm.message = "Error !";
}
});
After clicking the login button, the div
containing the message appears twice for a brief moment, creating a blink effect. The user cannot read the message properly due to this issue.
How can I prevent this blinking behavior?