Fork me on GitHub
ngProgress
A slim, site-wide progressbar for AngularJS
Installation Demo API

I recently saw Youtube's and Medium's new loading bars (and Medium don't get it) and was interested in implementing it on my own. In comes NProgress, a jQuery dependent plugin that creates this effect.

I didn't think the plugin needed a jQuery dependency, so I created my own AngularJS Provider that I can use for my heavy-applications. Try it out, fork it and submit a pull request if you want!

Right now, the plugin weighs 8kb, contains 12 different methods and has a dependency on Angular (duh).

Reach out to me on Twitter ( @VictorBjelkholm ) if you have feedback, criticisms or just want someone to blame for your problems. Or, visit the Github repository

## Installation

Manual: Download ngProgress.js or ngProgress.min.js

Automatic: Install using bower:

    bower install ngprogress

### Usage

Include ngProgress.js ( or ngProgress.min.js) and ngProgress.css in your website.

    <script src="app/components/ngProgress/ngProgress.js"></script>
    <link rel="stylesheet" href="ngProgress.css">

Set ngProgress as a dependency in your module

    var app = angular.module('progressApp', ['ngProgress']);

Inject ngProgressFactory in the controller where you plan to use it

    var MainCtrl = function($scope, ngProgressFactory) {
    }

Create a new instance of ngProgress and start showing the progress of things!

                  $scope.progressbar = ngProgressFactory.createInstance();
                  $scope.progressbar.start();

Use this command to start the progress bar. The ngProgress API will show you how to manipulate ngProgress.

    ngProgress.start();

## Demo

Progress:
Set progress

Start progressbar

Complete progressbar

Stop progressbar

Reset progressbar

Increment

Height:
Change height

Color:
Change color

### Contained

Start progressbar Complete progressbar Reset progressbar

## Share

Since the providers quality depends on peer-review, please review it yourself or share it to people that like to review stuff. I would be forever grateful and buy you a coffee if you are in Barcelona.

Vote on HN Tweet

## API

    ngProgressFactory.createInstance()

REQUIRED TO USE! Creates a new instance of ngProgress that you can use the methods below with.

    ngProgress.start();

Starts the animation and adds between 0 - 5 percent to the loading percentage every 400 milliseconds. Should always be finished with progressbar.complete() to hide it.

    ngProgress.height();

Sets the height of the progressbar. Use any valid CSS value Eg '10px', '1em' or '1%'.

    ngProgress.color();

Sets the color of the progressbar and it's shadow. Use any valid HTML color

    ngProgress.status();

Returns the current percent value the progressbar is at. Should'nt be needed.

    ngProgress.stop();

Stops the progressbar at its current location.

    ngProgress.set();

Sets the progressbar percentage value. Use a number between 0 - 100. If 100 is provided, complete will be called.

    ngProgress.reset();

Resets the progressbar to percentage 0 and will be hiden after it's rolled back.

    ngProgress.complete();

Jumps to 100% progress and fades away progressbar.

## License

The MIT License (MIT)

Copyright (c) 2013 Victor Bjelkholm

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.