ng-fool-click

In this example below you will see how to do a ng-fool-click with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 0xfc, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 0xfc ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>ng-fool-click</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <body ng-app="MyApp" ng-controller="MyCtrl">
  <button ng-click="handleClick()">Click me</button>
</body>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/feichao/ng-fool-click/master/src/ng-fool-click.js"></script>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/0xfc/ng-fool-click-RgEwWv */
button {
  background: blue;
  color: yellow;
  height: 40px;
  font-size: 18px;
  width: 160px;
}

.btn-in-promise {
  background: #ddd;
  color: #666;
  cursor: not-allowed;
}

/*Downloaded from https://www.codeseek.co/0xfc/ng-fool-click-RgEwWv */
angular.module('MyApp', ['ng-fool-click']).controller('MyCtrl', function($scope, $timeout, $q) {
  $scope.handleClick = function () {
    var defered = $q.defer();
    $timeout(function() {
      defered.resolve();
    }, 5000);
    return defered.promise;
  };
})

Comments