
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
angular-spinner
Advanced tools
Angular directive to show an animated spinner (using [spin.js](http://fgnass.github.io/spin.js/))
Angular directive to show an animated spinner (using spin.js)
Copyright (C) 2013, 2014, 2015, 2016, 2017 Uri Shaked, Islam Attrash and contributors
Get angular-spinner
$ npm install angular-spinner
from your console$ bower install angular-spinner
from your consoleInclude angular-spinner.js in your application.
import 'angular-spinner';
OR:
require('angular-spinner');
OR by picking one of the following file (depends on the package manager):
<script src="bower_components/angular-spinner/dist/angular-spinner.min.js"></script>
<script src="node_modules/angular-spinner/dist/angular-spinner.min.js"></script>
Add the module angularSpinner
as a dependency to your app module:
var myapp = angular.module('myapp', ['angularSpinner']);
You can now start using the us-spinner directive to display an animated spinner. For example :
<span us-spinner></span>
You can also pass spinner options, for example:
<span us-spinner="{radius:30, width:8, length: 16}"></span>
Possible configuration options are described in the spin.js homepage.
You can direct the spinner to start and stop based on a scope expression, for example:
<span us-spinner="{radius:30, width:8, length: 16}" spinner-on="showSpinner"></span>
You can use usSpinnerConfigProvider
to configure default options for all spinners globally. Any options passed from a directive still override these.
myapp.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
usSpinnerConfigProvider.setDefaults({color: 'blue'});
}]);
Themes provide named default options for spinners. Any options passed from a directive still override these.
myapp.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
usSpinnerConfigProvider.setTheme('bigBlue', {color: 'blue', radius: 20});
usSpinnerConfigProvider.setTheme('smallRed', {color: 'red', radius: 6});
}]);
<span us-spinner spinner-theme="smallRed"></span>
<button ng-click="startSpin()">Start spinner</button>
<button ng-click="stopSpin()">Stop spinner</button>
<span us-spinner spinner-key="spinner-1"></span>
The usSpinnerService
service let you control spin start and stop by key.
Whenever the key is not specified all the spinner will be affected (Start/Stop all spinners):
app.controller('MyController', ['$scope', 'usSpinnerService', function($scope, usSpinnerService){
$scope.startSpin = function(){
usSpinnerService.spin('spinner-1');
}
$scope.stopSpin = function(){
usSpinnerService.stop('spinner-1');
}
}]);
Note that when you specify a key, the spinner is rendered inactive. You can still render the spinner as active with the spinner-start-active parameter :
<span us-spinner spinner-key="spinner-1" spinner-start-active="true"></span>
spinner-start-active is ignored if spinner-on is specified.
The spinner-key will be used as an identifier (not unique) allowing you to have several spinners controlled by the same key :
<span us-spinner spinner-key="spinner-1"></span>
<span us-spinner spinner-key="spinner-2"></span>
... random html code ...
<!-- This spinner will be triggered along with the first "spinner-1" -->
<span us-spinner spinner-key="spinner-1"></span>
See online example on Plunker.
Released under the terms of MIT License.
npm i
npm run test
npm run build
once all tests are passing. Commit, push, PR.FAQs
Angular directive to show an animated spinner (using [spin.js](http://fgnass.github.io/spin.js/))
The npm package angular-spinner receives a total of 8,995 weekly downloads. As such, angular-spinner popularity was classified as popular.
We found that angular-spinner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.