Skip to content

Commit

Permalink
Adding a loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
praneethkumarpidugu committed Jul 6, 2016
1 parent f35051a commit 812a46d
Show file tree
Hide file tree
Showing 19 changed files with 797 additions and 2 deletions.
31 changes: 31 additions & 0 deletions libs/angular-spinner/.bower.json
@@ -0,0 +1,31 @@
{
"name": "angular-spinner",
"description": "Angular directive to show an animated spinner (using spin.js)",
"main": "./angular-spinner.js",
"author": "Uri Shaked",
"license": "MIT",
"homepage": "https://github.com/urish/angular-spinner",
"ignore": [],
"dependencies": {
"angular": "~1.x",
"spin.js": "~2.x"
},
"devDependencies": {
"angular-mocks": "~1.x"
},
"repository": {
"type": "git",
"url": "git://github.com/urish/angular-spinner.git"
},
"version": "0.8.1",
"_release": "0.8.1",
"_resolution": {
"type": "version",
"tag": "0.8.1",
"commit": "6cbf56991eb21756597ca675bbde804db136cbb5"
},
"_source": "https://github.com/urish/angular-spinner.git",
"_target": "^0.8.1",
"_originalSource": "angular-spinner",
"_direct": true
}
20 changes: 20 additions & 0 deletions libs/angular-spinner/.editorconfig
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

# Change these settings to your own preference
indent_style = tab
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions libs/angular-spinner/.gitignore
@@ -0,0 +1,4 @@
.idea
bower_components
node_modules
coverage
36 changes: 36 additions & 0 deletions libs/angular-spinner/.jshintrc
@@ -0,0 +1,36 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"maxdepth": 2,
"maxcomplexity": 7,
"globals": {
"angular": false,
"define": false,

"jasmine": false,
"expect": false,
"beforeEach": false,
"afterEach": false,
"describe": false,
"inject": true,
"it": false,
"spyOn": false
}
}
4 changes: 4 additions & 0 deletions libs/angular-spinner/.npmignore
@@ -0,0 +1,4 @@
.idea
bower_components
node_modules
coverage
9 changes: 9 additions & 0 deletions libs/angular-spinner/.travis.yml
@@ -0,0 +1,9 @@
language: node_js
sudo: false
node_js:
- 0.12
before_script:
- npm install -g bower@1.5.x grunt-cli@~0.1.9
- bower install
after_success:
- cat ./coverage/*/lcov.info | ./node_modules/coveralls/bin/coveralls.js
52 changes: 52 additions & 0 deletions libs/angular-spinner/CHANGELOG.md
@@ -0,0 +1,52 @@
# Changelog

## 0.8.1 - 2016-02-16
- Bugfix: Default options overwriting ([#81](https://github.com/urish/angular-spinner/pull/81), contributed by [dmytroyarmak](https://github.com/dmytroyarmak))

## 0.8.0 - 2015-10-29
- Improve UMD (Universal Module Definition) code, fixes ([#61](https://github.com/urish/angular-spinner/issues/61))
- Theme support ([#66](https://github.com/urish/angular-spinner/pull/66), contributed by [marknadig](https://github.com/marknadig))
- Add `spinner-on` attribute ([#71](https://github.com/urish/angular-spinner/pull/71), contributed by [marknadig](https://github.com/marknadig))

## 0.7.0 - 2015-09-09
- Add CommonJS support, improve AMD support (for use with browserify, webpack, SystemJS, etc.)

## 0.6.2 - 2015-07-02
- Relax Angular's dependency version lock ([#52](https://github.com/urish/angular-spinner/pull/52), contributed by [gottfrois](https://github.com/gottfrois))

## 0.6.1 - 2015-01-06
- Removed NBSP characters from source code ([#40](https://github.com/urish/angular-spinner/pull/40), contributed by [amolghotankar](https://github.com/amolghotankar))
- Return the created AngularJS module ([#37](https://github.com/urish/angular-spinner/pull/37), contributed by [k7sleeper](https://github.com/k7sleeper))

## 0.6.0 - 2014-12-12
- Added configurable default options ([#31](https://github.com/urish/angular-spinner/pull/31), contributed by [aleksih](https://github.com/aleksih))
- Added scope eval to allow for data binding support ([#21](https://github.com/urish/angular-spinner/pull/21), contributed by [jdamick](https://github.com/jdamick))

## 0.5.1 - 2014-08-09
- AMD / Require.js compatibility ([#11](https://github.com/urish/angular-spinner/pull/11), contributed by [floribon](https://github.com/floribon))
- Bugfix: Stop events are ignored if sent before the directive is fully initialized and `startActive` is true ([#22](https://github.com/urish/angular-spinner/pull/22), contributed by [vleborgne](https://github.com/vleborgne))

## 0.5.0 - 2014-06-03

- Add support for expressions in attributes ([#12](https://github.com/urish/angular-spinner/pull/12), contributed by [aaronroberson](https://github.com/aaronroberson))
- Generate source map for the minified version ([#14](https://github.com/urish/angular-spinner/issues/14))
- Add a `main` field to package.json ([#15](https://github.com/urish/angular-spinner/pull/15), contributed by [elfreyshira](https://github.com/elfreyshira))
- Enable support for AngularJS 1.3.x in bower.json

## 0.4.0 - 2014-03-15

- Upgrade spin.js to 2.0.0. See breaking changes [here](http://fgnass.github.io/spin.js/#v2.0.0).

## 0.3.1 - 2014-01-31

- Fixed an issue that caused the minified code to fail.

## 0.3.0 - 2014-01-26

- Add ability to control spinner state with bundled service (([#6](https://github.com/urish/angular-spinner/pull/6), contributed by [lossendae](https://github.com/lossendae))

## 0.2.1 - 2013-08-28

- Add test coverage reporting
- Stop the spinner on scope destroy
- Support for AngularJS 1.2
51 changes: 51 additions & 0 deletions libs/angular-spinner/Gruntfile.js
@@ -0,0 +1,51 @@
/* License: MIT.
* Copyright (C) 2013, 2014, Uri Shaked and contributors.
*/

'use strict';

module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);

grunt.initConfig({
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'angular-spinner.js',
'tests.js',
'karma.conf.js'
]
},
uglify: {
dist: {
options: {
sourceMap: true
},
files: {
'angular-spinner.min.js': 'angular-spinner.js'
}
}
}
});

grunt.registerTask('test', [
'jshint',
'karma'
]);

grunt.registerTask('build', [
'uglify'
]);

grunt.registerTask('default', ['build']);
};
134 changes: 134 additions & 0 deletions libs/angular-spinner/README.md
@@ -0,0 +1,134 @@
# angular-spinner

Angular directive to show an animated spinner (using [spin.js](http://fgnass.github.io/spin.js/))

Copyright (C) 2013, 2014, 2015, 2016, Uri Shaked <uri@urish.org>.

[![Build Status](https://travis-ci.org/urish/angular-spinner.png?branch=master)](https://travis-ci.org/urish/angular-spinner)
[![Coverage Status](https://coveralls.io/repos/urish/angular-spinner/badge.png)](https://coveralls.io/r/urish/angular-spinner)

## Usage

Get both spin.js and angular-spinner

- via npm: by running ``` $ npm install angular-spinner ``` from your console
- or via Bower: by running ``` $ bower install angular-spinner ``` from your console

Include both spin.js and angular-spinner.js in your application.

```html
<script src="bower_components/spin.js/spin.js"></script>
<script src="bower_components/angular-spinner/angular-spinner.js"></script>
```

Add the module `angularSpinner` as a dependency to your app module:

```js
var myapp = angular.module('myapp', ['angularSpinner']);
```

You can now start using the us-spinner directive to display an animated
spinner. For example :

```html
<span us-spinner></span>
```

You can also pass spinner options, for example:

```html
<span us-spinner="{radius:30, width:8, length: 16}"></span>
```

Possible configuration options are described in the [spin.js homepage](http://fgnass.github.io/spin.js/).

You can direct the spinner to start and stop based on a scope expression, for example:

```html
<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.

```js
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.

```js
myapp.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
usSpinnerConfigProvider.setTheme('bigBlue', {color: 'blue', radius: 20});
usSpinnerConfigProvider.setTheme('smallRed', {color: 'red', radius: 6});
}]);
```

```html
<span us-spinner spinner-theme="smallRed"></span>
```

### Using the usSpinnerService to control spinners

```html
<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 :

```js
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 :
```html
<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 :

```html
<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](http://plnkr.co/edit/BGLUYcylbIVJRz6ztbhf?p=preview).

## License

Released under the terms of MIT License.

## Contributing

1. Fork repo.
2. `npm install`
3. `bower install`
4. Make your changes, add your tests.
5. `grunt test`
6. `grunt build` once all tests are passing. Commit, push, PR.

0 comments on commit 812a46d

Please sign in to comment.