i am new in angular js. i done with div hide and show. just i want to know how to hide or show div for 3 seconds only. here i attaching my code which i used.
html code:
<div ng-hide="loginAlertMessage">Dynamic user feedback message comes here.</div>    
<a ng-click="forgotPassword()">Forgot Password?</a>
angular js code:
$scope.loginAlertMessage = true;
    $scope.forgotPassword = function () {
         $scope.loginAlertMessage=false;    
    };
                Inject the $timeout service in the controller and use it to unset loginAlertMessage.
app.controller('MyController', ['$scope', '$timeout', function($scope, $timeout) {
   $scope.loginAlertMessage = true;
   $scope.forgotPassword = function() {
      $scope.loginAlertMessage = false;
      $timeout(function() {
         $scope.loginAlertMessage = true;
      }, 3000);
   };
   // ...
}]);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With