apollodec/Apollo/assets/js/controllers/laddaCtrl.js
saravanakumar_kandasami 7d72a0b91a updated code
2017-11-21 14:56:39 +05:30

29 lines
1.0 KiB
JavaScript

'use strict';
/**
* controller for angular-ladda
* An angular directive wrapper for Ladda buttons.
*/
app.controller('LaddaCtrl', ["$scope", "$timeout", function ($scope, $timeout) {
$scope.ldloading = {};
$scope.clickBtn = function (style) {
$scope.ldloading[style.replace('-', '_')] = true;
$timeout(function () {
$scope.ldloading[style.replace('-', '_')] = false;
}, 2000);
};
$scope.clickProgressBtn = function (style) {
$scope.ldloading[style.replace('-', '_') + "_progress"] = true;
$timeout(function () {
$scope.ldloading[style.replace('-', '_') + "_progress"] = 0.1;
}, 500);
$timeout(function () {
$scope.ldloading[style.replace('-', '_') + "_progress"] += 0.1;
}, 1000);
$timeout(function () {
$scope.ldloading[style.replace('-', '_') + "_progress"] += 0.1;
}, 1500);
$timeout(function () {
$scope.ldloading[style.replace('-', '_') + "_progress"] = false;
}, 2000);
};
}]);