npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-spin

v1.0.2

Published

$http interceptor spinner for angular.js

Downloads

9

Readme

ng-spin

$http interceptor spinner for angular.js

Sometimes, you just need to show a spinning animation for some or every $http (ajax) request. This module makes your life easier by providing global, request specific and manual/non-http option to show/hide spinner. Shipped with multiple spinner types made by tobiasahlin.


Install

Bower

bower install ng-spin

npm

npm install ng-spin

Include angular.min.js, ng-spin.min.js and ng-spin.min.css

Add thatisuday.ng-spin module to your app's dependencies list.


Config

angular
.module('myApp', ['thatisuday.ng-spin'])
.config(function(ngSpinOpsProvider){
	ngSpinOpsProvider.setOps({
		autoGlobal : false,
		spinner : 'big-bang',
		size : 'normal',
		color : '#333',
		position : 'right-top',
		blocking : false,
		delay : 0,
		extend : 100
	});
})

| option | values | default | role | | ------ | ------ | ------- | ---- | | autoGlobal | true/false | false | show spinner for every $http request (automatically) | | spinner | bars, big-bang, binary, cubes, flipboard, ping, plane, snake, sos, worm | big-bang | choose spinner animation type | | size | normal, sm, xs | normal | size of the spinner | | color | hex, rgba | #333 | color of the spinner | | position | left-top, right-top, left-bottom, right-bottom, center | right-top | position of the spinner on the page | | blocking | false, white, black, transparent | false | show page overlay for spinner | | delay | time in milliseconds | 0 | delay animation start | | extend | time in milliseconds | 100 | extend animation |

delay and extend options are used only in case of Global or Request specific implementation.

Do not add delay more than extend.


Implement (use)

Global (auto)

If you are setting autoGlobal in config to true then you pretty much done here. All your $http requests will be intercepted by ng-spin and spinner will be shown.

But If you want to show animation manually, then there are two other options as mentioned below.

Request specific (semi-auto)

$http({
	url : 'api.ofawebsite.com/user/me',
	method : 'POST',
	ngSpin : true
})

Setting ngSpin to true in request object of a $http request will trigger ng-spin interceptor to show spinner for that request.

Manual

You can use $ngSpin service which returns start and stop method for spinner.

myApp.controller(function($ngSpin, $scope){
	$scope.loadData = function(){
		$ngSpin.start();

		$http({...}).then(function(res){
			$ngSpin.stop();
		});
	}
});

Demo

Preview

As most of the thing is happening inside config phase, there isn't must to simulate. Clone this repo and open demo/main.html in browser. Try different options in config block.

Go to archibiz.com to get a look and feel of it. I have set autoGlobal to true, so every $http request is intercepted by ng-spin.


Build

This repo is built with gulp. Clone this repo and use npm install --only=dev for custom build.


Bug reports andContribution

  • If you have any queries or bug reports, create issues here or send me email on [email protected]
  • If you have more spinners or any enhancement, please send a PR with details.
  • If you run naked around a tree, at about 87 km/h, there is a possibility of fucking yourself.