laddaCtrl.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. /**
  3. * controller for angular-ladda
  4. * An angular directive wrapper for Ladda buttons.
  5. */
  6. app.controller('LaddaCtrl', ["$scope", "$timeout", function ($scope, $timeout) {
  7. $scope.ldloading = {};
  8. $scope.clickBtn = function (style) {
  9. $scope.ldloading[style.replace('-', '_')] = true;
  10. $timeout(function () {
  11. $scope.ldloading[style.replace('-', '_')] = false;
  12. }, 2000);
  13. };
  14. $scope.clickProgressBtn = function (style) {
  15. $scope.ldloading[style.replace('-', '_') + "_progress"] = true;
  16. $timeout(function () {
  17. $scope.ldloading[style.replace('-', '_') + "_progress"] = 0.1;
  18. }, 500);
  19. $timeout(function () {
  20. $scope.ldloading[style.replace('-', '_') + "_progress"] += 0.1;
  21. }, 1000);
  22. $timeout(function () {
  23. $scope.ldloading[style.replace('-', '_') + "_progress"] += 0.1;
  24. }, 1500);
  25. $timeout(function () {
  26. $scope.ldloading[style.replace('-', '_') + "_progress"] = false;
  27. }, 2000);
  28. };
  29. }]);