Git Product home page Git Product logo

ngprogress-lite's Introduction

ngprogress-lite

Bitdeli Badge

Nice looking slim progress bars provider for Angular.js applications.

It has similar API as original popular jQuery plugin (see references) to keep things as simple as possible.

The only dependency is angular.js framework.

File size is ~2kb when minified.

Install

You can download ngprogress-lite.js manually or install it with bower:

bower install ngprogress-lite

or npm:

npm install ngprogress-lite

You will need only to include ngprogress-lite.css and ngprogress-lite.js to your project, and then you can start using ngProgressLite provider in your controllers, services or directives.

Usage

For simple usage you can just call start() and done(), for example:

ngProgressLite.start();
$timeout(function () {
	ngProgressLite.done();
}, 2000);

For more advanced usage you can set the number between 0 and 1 to set progress bar to specific state:

ngProgressLite.set(0.5);
ngProgressLite.set(1.0);

You can also increment the progress bar by random number (this will never get to 100%):

ngProgressLite.inc();

Also it is possible to get current state number of a progress bar:

ngProgressLite.get()

Configuration

Provider is highly customizable, here is the list of some options that you can specify:

  • minimum - change the minimum percentage (defaults to 0.08)
  • speed - speed of transition animations (defaults to 300)
  • ease - type of transition easings
  • and even template - but it's not recommended though :)

Use ngProgressLiteProvider settings object in module's config:

angular.module('yourModule', ['ngProgressLite'])
	.config(['ngProgressLiteProvider', function (ngProgressLiteProvider) {
		ngProgressLiteProvider.settings.speed = 1500;
	}]);

Customization

If you want to change progress bar's look, you need just edit tiny ngprogress-lite.css file. Feel free to rewrite it as you wish ;)

If you have some style issues, please be sure that ngprogress-lite.css is not overwritten by other styles (e.g. z-index Bootstrap's navbar - link)

References

Inspired by Google, YouTube, Medium, etc.

  • nprogress - original jQuery dependant solution

(c) 2013 MIT License

ngprogress-lite's People

Contributors

aidask avatar alexbeletsky avatar daviesgeek avatar deyine avatar dstockhammer avatar igor-milenkovic-clariness avatar jonaswindey avatar superpaintman avatar swallez avatar voronianski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngprogress-lite's Issues

Socket.io

Hi ,
I want to know if this conflicts with socket.io as i plan on using both in the same app.
Pace.js had the issue of interference with socket.io

Allow on npm?

Hi,

Thank's for this. Is that possible to provide your package on npm?

Bests

$timeout dependency can be dropped

https://github.com/voronianski/ngprogress-lite/blob/master/ngprogress-lite.js#L77
https://github.com/voronianski/ngprogress-lite/blob/master/ngprogress-lite.js#L82
https://github.com/voronianski/ngprogress-lite/blob/master/ngprogress-lite.js#L84
https://github.com/voronianski/ngprogress-lite/blob/master/ngprogress-lite.js#L103

Angular $timeout service is special, because it also runs a digest cycle with $apply() method.
However, we only change css, but not the scope. This means we don't need to run $apply, because nothing has changed in the scope.
It would be better to change $timeout with native setTimeout.

Finish with error

Hey! Great plugin!

Right now I'm using it this way:

onRequest:
    progress.start()
onSuccess:
    progress.done()
onError:
    progress.done()

However, I would like to change the presentation of progress bar when request is resulted in error. In my case, I would like to color it as red, but when the next request starts I would like it to be blue again.

What is the best way to do this? Maybe this feature is worth adding to the module itself?

Thanks!

jobs with different duration

As I have jobs with different durations (few seconds to a few minutes) I'd like to adjust the progress bar. I wonder if setting the trickleRate is the right place for adjusting the load progress?

Uglify mangle

Why uglify mangle option is set to false? Does it break something important in the code?

Position, any help?

Is it possible to have this progress bar appearing into a specific div?

How would you go about it?

Appreciate it.

multiple ajax requests

Hello, nice plugin!

In my case i do an normal ajax request to get some collection data from the server and furthermore an geolocation.getCurrentPosition request.

The progress should only reach 100% if both of them are done.

At the moment, i start and end every ajax request with a progress-bar, so i don't have to handle everything for myself every time again. For the currentPostionen request i have to start a "second" progress-bar. This resolves into one correct progress (short ajax request) and after that the second "done()" (position) kicks in and shows up for a short amount of time.

The plugin should add up progresses and resolve them only if all off them are resolved.

Thank you very much
Marcel

Bower requirements

How about changing "angular": "~1.0.8" requirement to "~1". I think this should be working on angular 1.2 version too, because it has only a few breaking changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.