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

ngactivityindicator

v0.1.10

Published

Simple Angular.js preloaders provider

Downloads

257

Readme

ngActivityIndicator

Simple application preloader animation provider for Angular.js applications.

ngActivityIndicator is small, all-in-one solution, customizable through themes and dependant only on Angular.js.

Demo

Install

You can download all necessary ngActivityIndicator files manually or install it with bower:

bower install ngActivityIndicator

Usage

You need to include ngActivityIndicator.js and ngActivityIndicator.css (as minimal setup) to your project and then you can start using $activityIndicator service wherever you want - inside your directives, controllers or services. For example in controllers:

var app = angular.module('exampleApp', ['ngActivityIndicator']);

app.controller('MainCtrl', ['$activityIndicator', '$timeout',
	function ($activityIndicator, $timeout) {
		$activityIndicator.startAnimating();
		$timeout(function () {
			$activityIndicator.stopAnimating();
		}, 3000);
	}
]);

You can use ngActivityIndicator directive to show one of built-in animated views or you are able to create your own preloader in html, style it with CSS and simply show/hide it:

<body>
	<div ng-show="AILoading" class="your-preloader"></div>
	<div ng-hide="AILoading" ng-view></div>
</body>

Also this service can be easily used with loading SVG concept by Brett Jackson. But be aware of limited browser SVG support and user experience issues with perceptual loading time - http://caniuse.com/svg-smil.

Or you can use preloader styles from Luke's https://github.com/lukehaas/css-loaders as well.

API

API is highly inspired by Objective-C UIActivityIndicatorView class from UIKit framework.

startAnimating()

Start preload animation by setting $rootScope.AILoading to true.

stopAnimating(delay)

Stop animating preloader by setting $rootScope.AILoading to false.

isAnimating()

Check whether activity indicator is animating or not.

setActivityIndicatorStyle()

There are several styles built-in. Style by default is CircledGrey, you can change it by setting the value string on $activityIndicatorProvider, example:

angular.module('yourModule', ['ngActivityIndicator'])
	.config(['$activityIndicatorProvider', function ($activityIndicatorProvider) {
		$activityIndicatorProvider.setActivityIndicatorStyle('SpinnerDark');
	}]);

Directive

Module is shiped with helpful directive. It is called as ngActivityIndicator and can behave differently based on the tag or restrict it's used with.

When it's added to <body> tag, it adds relevant preloader into the app, shows and hides ng-view while animating. It's recommended and the most common use-case, example:

<!-- Indicator is injected into the DOM automatically -->
<body ng-activity-indicator>

	<!-- ngView is shown/hidden automatically -->
	<div ng-view></div>
</body>

If you prefer to manage what to show on preloading mode by yourself, just use it as an element or attribute. Directive will handle animation status automaticly, example:

<body>
	<!-- it is shown/hidden automatically -->
	<div ng-activity-indicator class="center"></div>

	<!-- show/hide elements based on $rootScope.AILoading property -->
	<div ng-hide="AILoading" class="some-wrapper"></div>
</body>

You can also override preloader style by adding it's name as directive value:

<div ng-activity-indicator="CircledDark"></div>

Skip ngShow

Sometimes it's useful to control indicator show/hide behavior by your own $scope (for example if you have multiple loaders inside one view). In this case there is additional attribute for directive:

skip-ng-show="[yes/no]"

It's easy to use, just add it on the activity indicator directive:

<div ng-show="myLoadingConditional" ng-activity-indicator skip-ng-show="yes"></div>

This will ends up in skipping ng-show="AILoading" directive on ngActivityIndicator element and will add ability to control loader presence by myLoadingConditional.

Built-in styles

You're able to choose what indicator suites you most within default ones or create your own.

List of style names:
  • CircledWhite / CircledGrey (default) / CircledDark
  • DottedWhite / DottedGrey / DottedDark
  • SpinnerWhite / SpinnerGrey / SpinnerDark

Contribution

Want to add your styles into this module? Cool, just fork this repo and make pull-request!

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

MIT Licensed

Copyright (c) 2014, Dmitri Voronianski [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.