javascript - AngularJS duplicated element for 1 second -


i have login form contains box display error message

<div class="ui negative message" ng-if="vm.message != ''">     <span ng-bind="vm.message"></span> </div> 

the message set inside controller

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 !";     } }); 

my problem div containing message shown 2 times during 1sec after clicking on login button. during 0.5/1 second have 2 times same div same message.

user cannot see says can see blinking.

how can avoid getting blink ?

your ng-if doesn't work in html, change this:

<div class="ui negative message" ng-if="vm.message">   <span ng-bind="message"></span> </div> 

the statement ng-if="vm.message != ''" did not hide element causes blinking. can declare vm-message = null in controller when it's loaded make sure.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -