mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-22 03:06:20 +10:00
34 lines
728 B
JavaScript
34 lines
728 B
JavaScript
/* angular-spinner version 0.2.1
|
|
* License: MIT.
|
|
* Copyright (C) 2013, Uri Shaked.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
angular.module('angularSpinner', [])
|
|
.directive('usSpinner', ['$window', function ($window) {
|
|
return {
|
|
scope: true,
|
|
link: function (scope, element, attr) {
|
|
scope.spinner = null;
|
|
|
|
function stopSpinner() {
|
|
if (scope.spinner) {
|
|
scope.spinner.stop();
|
|
scope.spinner = null;
|
|
}
|
|
}
|
|
|
|
scope.$watch(attr.usSpinner, function (options) {
|
|
stopSpinner();
|
|
scope.spinner = new $window.Spinner(options);
|
|
scope.spinner.spin(element[0]);
|
|
}, true);
|
|
|
|
scope.$on('$destroy', function () {
|
|
stopSpinner();
|
|
});
|
|
}
|
|
};
|
|
}]);
|