angular-spinner

WebJar for angular-spinner

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-spinner
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

angular-spinner
WebJar for angular-spinner
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Attrash-Islam/bower-angular-spinner

Download angular-spinner

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-spinner/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-spinner</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-spinner/
implementation 'org.webjars.bower:angular-spinner:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-spinner/
implementation ("org.webjars.bower:angular-spinner:1.0.1")
'org.webjars.bower:angular-spinner:jar:1.0.1'
<dependency org="org.webjars.bower" name="angular-spinner" rev="1.0.1">
  <artifact name="angular-spinner" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-spinner', version='1.0.1')
)
libraryDependencies += "org.webjars.bower" % "angular-spinner" % "1.0.1"
[org.webjars.bower/angular-spinner "1.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

angular-spinner

Angular directive to show an animated spinner (using spin.js)

Copyright (C) 2013, 2014, 2015, 2016, 2017 Uri Shaked, Islam Attrash and contributors

Build Status Coverage Status

Usage

Get angular-spinner

  • via npm: by running $ npm install angular-spinner from your console

Include angular-spinner.js in your application.

import 'angular-spinner';

OR:

require('angular-spinner');

OR by picking one of the following files (minified/not-minified):

<script src="node_modules/angular-spinner/dist/angular-spinner.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>

Configuring default spinner options

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

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>

Using the usSpinnerService to control spinners

<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>

Example

See online example on Plunker.

License

Released under the terms of MIT License.

Contributing

  1. Fork repo.
  2. npm i
  3. Make your changes, add your tests.
  4. npm run test
  5. npm run build once all tests are passing. Commit, push, PR.

Versions

Version
1.0.1
0.8.1
0.8.0
0.7.0
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.0