Giter Club home page Giter Club logo

ngprogress's Issues

Add a check to avoid multiple start

A multiple call of start() method causes a multiple call of setInterval(....). Since the timerId returned by the setInterval(...) call is stored always in the same variable, this behavior causes a number of orphan times that cannot be stopped.

Strange behavior in $route

I made efficient ngProgress, by placed it in rootScope events:

  • I place ngProgress.start() in $rootScope.$on('$routeChangeStart'
  • place ngProgress.complete() in $rootScope.$on('$routeChangeSuccess'

Unfortunately, I got strange behavior with the progress. Is this module fit with my approach?

some demo controls not working

increment, change height and change color are throwing errors in the console and not working.

when clicking on increment

TypeError: ngProgress.status is not a function
    at Object.$scope.count (http://victorbjelkholm.github.io/ngProgress/:369:47)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:6129:19
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:12496:13
    at Object.Scope.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:7770:28)
    at Object.Scope.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:7850:23)
    at HTMLAnchorElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:12495:17)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:1930:10
    at Array.forEach (native)
    at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:110:11)
    at HTMLAnchorElement.eventHandler (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:1929:5)
$scope.count = function($event) {
  $event.preventDefault();
  $scope.progressbar.set(ngProgress.status() + 9); // .status() is not a function
}

when clicking on change height

TypeError: Cannot read property 'preventDefault' of undefined
    at Object.$scope.new_height (http://victorbjelkholm.github.io/ngProgress/:378:19)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:6129:19
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:12496:13
    at Object.Scope.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:7770:28)
    at Object.Scope.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:7850:23)
    at HTMLAnchorElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:12495:17)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:1930:10
    at Array.forEach (native)
    at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:110:11)
    at HTMLAnchorElement.eventHandler (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:1929:5)
$scope.new_height = function(new_height, $event) {
  $event.preventDefault(); // $event is not defined
  $scope.progressbar.height(new_height);
}

when clicking on change color

TypeError: Cannot read property 'preventDefault' of undefined
    at Object.$scope.new_color (http://victorbjelkholm.github.io/ngProgress/:373:19)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:6129:19
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:12496:13
    at Object.Scope.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:7770:28)
    at Object.Scope.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:7850:23)
    at HTMLAnchorElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:12495:17)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:1930:10
    at Array.forEach (native)
    at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:110:11)
    at HTMLAnchorElement.eventHandler (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js:1929:5)
$scope.new_color = function(color, $event) {
  $event.preventDefault(); // $event is not defined
  $scope.progressbar.color(color);
}

i could take a deeper look later

Not able to inject ngProgressFactory into controller

I always get this error: "Error: [$injector:unpr] Unknown provider: aProvider <- a <- ngProgressFactory".
I followed the tutorial: http://victorbjelkholm.github.io/ngProgress
Thanks.

angular.module("testProgressApp", [
"ngRoute",
"ngProgress"
]).controller("AppController", ["$scope", "ngProgressFactory", function ($scope, ngProgressFactory) {
$scope.progressbar = ngProgressFactory.createInstance();
$scope.progressbar.start();
}]);

Sometimes ngprogress starts when switching browser tabs and never ends.

Hello,

I'm using ngprogress 1.0.4 and latest Chrome v35.
ngprogress is working quite well.
Sometimes I minimize Chrome (with the page that contains ngprogress opened) or switch between the chrome tabs.
LATER when I get back to the page that contains ngprogress
the progress bar starts and never ends.
The 'start' is not executed by any piece of my source code.

Sometimes I'm experiencing the same issue at the official page: http://victorbjelkholm.github.io/ngProgress/#demo
What I do:

  1. Open http://victorbjelkholm.github.io/ngProgress/#demo
  2. Leave it opened and do my other work in different browser tabs. Later I click on the tab where http://victorbjelkholm.github.io/ngProgress/#demo is opened
    and the progress bar starts filling but it never ends. It stucks at about 90%-95%
    If I do any action that starts again or ends the progress bar it will get working normally.

BR,
Stanislav

I get 'Cannot read property 'start' of undefined'

I'm using 'ngbp' (https://github.com/ngbp/ngbp) angular boilerplate to build my project and I'm trying to make ngProgress work to show the loader when changing from section to section.

I've installed ngProgress through bower. I have css and js in place.

In my app.js I have this:

(function(app) {

    app.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.otherwise('/');
    }]);

    app.run(function () {});

    app.controller('AppController', ['$scope', function ($scope) {
    }]);

}(angular.module("grinFood", [
    'grinFood.home',
    'grinFood.about',
    'grinFood.menu',
    'grinFood.catering',
    'grinFood.takeithome',
    'grinFood.contact',
    'templates-app',
    'templates-common',
    'ui.router.state',
    'ui.router',
    'ngProgress',
])));

Then for example my catering.js looks like this:

(function(app) {

    app.config(['$stateProvider', function ($stateProvider) {
        $stateProvider.state('catering', {
            url: '/catering',
            views: {
                "main": {
                    controller: 'CateringController',
                    templateUrl: 'catering/catering.tpl.html'
                }
            },
            data:{ pageTitle: 'Catering' }
        });
    }]);

    app.controller('CateringController', ['$scope', function ($scope, ngProgress) {

        var init = function() {
            // A definitive place to put everything that needs to run when the controller starts. Avoid
            //  writing any code outside of this function that executes immediately.
            ngProgress.start();
        };

        init();
    }]);

}(angular.module("grinFood.catering", [
    'ui.router'
])));

That is when I get TypeError: Cannot read property 'start' of undefined
Also tried to put the ngprogress in the controller in app.js but I can't make it work.

You can watch the error here: http://ticketcomunicacion.com/grinfood/#/menu

Any help would be appreciate. Thanks

How do I set the color?

I can't set the color of the progressbar. I tried assigning it:

ngProgress.color = 'green';

Calling it (like the docs say):

ngProgress.color('green');

And calling setColor():

ngProgress.setColor('green');

None of them seem to work. How do I set the color?

progress bar position

Hi,

I am very new to angular and like progress bar a lot.

When I try this in my application (in layout.chtml [master page]). It always shows up the progress bar at the bottom of page.

How can I put this just below the header like Youtube ?

Any help is appreciated.

Thanks,
Abhisek

Styling must not belong to JavaScript

Presentation must be separate from business logic.

I suggest to deprecate methods like height and color and replace them with CSS styling completely.

Right now I can't use my SCSS styles and variables to style progress bar and this is really wrong.

Fail Test !

Hi !!

Great work but i had an issue with karma unit test. When i start test with grunt i have an error like

Error: No module: ngProgress

An idea ??

Blocking fields when progress bar is active

I have a necessity the blocking fields of form when progress bar is actived. My form contains fields of registers which can not be editable after clicked in button save.

Any suggestion?

Concurrent ngProgress.start() breaks loading bar

Hi.

First of all, awesome job porting this into Angular. Its really easy to use and looks really nice.

Secondly, I wanted to let you know that I found that when you call ngProgress.start() more than once (two concurrent ajax calls for example) the loading bar kind of breaks. Is there something am I doing wrong? Or perhaps a quick fix for this?

Thanks a lot in advance.

Progress bar does not go away after calling complete()

I've included the progress bar in my app by calling setLoading() on the event '$routeChangeStart'. Then, on the events '$routeChangeSuccess' or '$routeChangeError' I will call complete().

But I've noticed if I click around on my site a few times the loading bar will get stuck and wont go away even after calling complete().

I can replicate this behavior on http://victorbjelkholm.github.io/ngProgress by repeatedly clicking on 'Start progressbar' then 'Complete progressbar'. After a few clicks the bar gets stuck.

Use ngProgress when route starts changing

I'm new in AngularJS world, please help someone!!
I want to start progress when route starts changing and stop when route ends:

  .run(['$location', '$rootScope', function($location, $rootScope) {
    $rootScope.$on('$routeChangeStart', function(event, current, previous){
      //
    });
    $rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
      //
    });
  }]);

Add increment() function

I believe there is a use case for a function that increments the progress bar in some manner, without knowing explicitly what percentage to set it at. Here's an example:

async.parallel([
    function(callback) {
    do_something();
    ngProgress.increment();
    },
    function(callback) {
       do_something_else();
       ngProgress.increment();
    }], //end of paralell calls
    function() {
     //we're done!
     ngProgress.complete()
    }
);

Either of those two parallel calls could complete before the other, and they should have no knowledge of what the current percentage of the statusbar is. All they know is that they are done with their portion of the work.

Version 1.1.2 uses all-lowercase file naming as opposed to previously used camel-case naming convention

Previous versions used to follow camel-case naming convention for the files, e.g. ngProgress/build/ngProgress.js, and now it's
ngprogress/build/ngprogress.js.

It gets rather confusing/broken if upgraded via bower on a case-sensitive file system, since it'll keep the old camel-case-named files next to new lowercase ones and you might assume you've got a new version while your website will be actually using an old one.

How can set height property globally?

I am looking for a way to set height property globally? (but not in raw css) i am thinking like

.config(["ngProgress", function(ngProgress) {
  ngProgress.setHeight('10px');
}]);

possible? since written as provider ?

$scope.$apply from ngProgress.color is interfering with $templateCache service, when called from angular.module().run method

Here's a sample of run() method

angular
    .module('portal', dependencies)
    .run(['$rootScope', '$http', 'ngProgress', 'NotifyService', function($rootScope, $http, ngProgress, Notify) {
        ngProgress.color('#66afda');
        $rootScope.pendingRequests = $http.pendingRequests;
        $rootScope.$watch('pendingRequests', function(requests) {
            ngProgress[requests.length !== 0 ? 'start' : 'complete']();
        }, true);

        $rootScope.$on('$routeChangeError', function() { Notify.error('An error occured when trying to change the current route!'); })

    }]);

and here's a sample of routes configuration

$routeProvider
    .when('/application-:appId', {})
    .when('/application-:appId/:portalViewId/:viewType-:viewId', {
        controller: 'PortalViewCtrl',
        reloadOnSearch: false,
        templateUrl: function($routeParams) {
            var viewType = $routeParams.viewType;
            return (viewType && portalViewTypes.indexOf(viewType) > -1) && 'portal/portal-views/' + viewType + '/' + viewType + '-view.html';
        }
    })

    .otherwise({redirectTo: '/'});

We're using ngTemplates Grunt plugin to check get all the templates and put them into $templateCache service.

Please note that all the template are included, the paths are correct within this service, everything works ok either by removing the ngProgress.color('#66afda'); line, or commenting out the line where the scope is manually applied (from ngProgress code).

Allow setting a label to describe the current progress stage

I'd suggest adding to the API a function called setLabel that provides a string describing the current progress stage. This optional label should be rendered inside the progress bar area. The label should be undefined by default resulting in the current ngProgressbar behaviour.

critical code enhancements

The code has several critical design fallacies, wich have to be corrected, primarily being:

  • operating on global namespace
  • polluting $rootScope
  • several misusages of the 'this'-function
  • some Angular module weirdness...

Allow mutliple progress-bars

ngProgress works great if you want one global progress bar at the top of the page. But it'd be nice if you could have multiple progress bars in a page at different locations (think multiple widgets, each with their own progress bar).

Minified version not working

I got this error when using the .min version.

Error: Unknown provider: aProvider <- a <- ngProgressDirective <- ngProgress
    at Error (<anonymous>)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:30:24
    at Object.c [as get]

Probably the minifer changed the names or something like that. Not sure if you can set some variables name to maintain when minifying.

Anyways, just letting you know.

Create ngProgress $http interceptor

Hi Victor.

I saw your great ngProgress bar and wished to switch to it from my ugly spinner loader.
Usually I use $http interceptor, like in the following code:

app.config ["$httpProvider", "progressbar", ($httpProvider, progressbar)->
    $httpProvider.responseInterceptors.push('progressAnimation')
    spinnerFunction = (data, headersGetter)->
      progressbar.start()
      data;
    $httpProvider.defaults.transformRequest.push(spinnerFunction)


    $ ->
      $(document)
        .ajaxStart ->
          progressbar.start()
        .ajaxStop ->
          progressbar.complete()
  ]

  app.factory 'progressAnimation', ["$q", "progressbar", ($q, progressbar)->
    (promise)->
      return promise.then (response)->
        progressbar.complete()
        response
      , (response)->
        progressbar.complete()
        $q.reject(response)
  ]

Sure, it doesn't work.

  • To intercept, I have to use $httpProvider, which is available in config -- no $http object is created yet.
  • To use ngProgress, I have to use its singleton object, not a provider, so I should wire it in run.
  • How can I get both objects at the same time?

Also it looks like it is the most simple plain case to use ngProgress, probably it worth to add some function to its api.

Control progress bar from app.run()

Something like this.
I think that is very much more effective.

I'm using ui-router module

app.run(['$rootScope', '$state', 'ngProgress', function($rootScope, $state, $timeout, ngProgress) {
  $rootScope.$on('$stateChangeStart', function(){
    ngProgress.start();
  });

  $rootScope.$on('$stateChangeSuccess', function(){
    ngProgress.complete();
  });

  $rootScope.$on('$stateChangeError',  function(){
    ngProgress.complete();
    console.log("Error to load the route.")
  });
}])

[Bug] Loading bar hangs and does not finish loading.

I was able to reproduce issue #24 (related) using ngProgress' own demo page at [1].

Click "Start progress bar" then immediately click Start again. Alternatively, quickly click Start -> Complete -> Start again.

The progress bar slowly fills and as it gets closer to the end it slows down to a halt. There is no way to actually get it to complete once it gets like that, unless you refresh the page.

[Update] This was tested under Chrome 37.

[1] https://victorbjelkholm.github.io/ngProgress/

File name capitalisation error

The css file has a capital P ngProgress.css
The js files do not ngprogress.js

The bower files build property says that the js file is named ngProgress.js which is incorrect.

css in source - move to separate .css file

thanks for cool module!

but i don't really like (and do not see any obvious reasons here) to keep styles inside source code, especially to clog my app that will use this module with dynamically created <style> blocks :(

original plugin contains nice styles file, that can be improved and ported here.

as a solution, inlining style can be an option (turned on or turned off by default as you wish).

Enhance the readme in order to make it more readable.

I would suggest to change the API section's structure a bit. The whole section should not be code, it should be split into headings and code snippets. Also language for other code snippets should be added e.g. javascript for code coloring.

I will gladly do it if you find it reasonable.

Bower install without the css file

Hello,

bower installs the package without the css file: ngProgress.css.
You can fix this problem if you add the ngProgress.css in the main of bower.json.
This fixes the issue:

"main": [ "build/ngProgress.js",
              "ngProgress.css" ],

With best regards
coderDem

ngProgress plugin is making http calls in Jasmine unit tests

I have a situation in my unit test where the ngProgress plugin is making http calls, which is messing up my unit tests as I am getting unexpected get errors:

Uncaught Error: Unexpected request: GET http://upda...

here is the stack grace

> request(), app.js:35 deferred.promise.then.wrappedCallback(),
> angular.js:10597 deferred.promise.then.wrappedCallback(),
> angular.js:10597 anonymous(), angular.js:10683 $get.Scope.$eval(),
> angular.js:11576 $get.Scope.$digest(), angular.js:11421
> $get.Scope.$apply(), angular.js:11682 updateCount(),
> ngProgress.min.js:8 anonymous(), ngProgress.min.js:8

Backward compatibility of 1.1 with 1.0

The changes introduced in 1.1, related to providing a factory ngProgressFactory instead of a service (I presume) ngProgress provided in previous versions are not backward compatible and breaks every single usage of ngProgress.
I understand that this change was necessary in order to be able to provide multiple instances of ngProgress and maybe there were other reasons for it I'm not aware of, but would you consider providing ngProgress service along with ngProgressFactory for backward compatibility?

bower 1.0.6 points to 1.0.5 release

When trying to install ngprogress through bower via "bower install ngprogress --save" it adds the correct version 1.0.6 to bower.json, but the source files are version 1.0.5

the api is not correct

Maybe the provided api is not updated after new version. I used bower install and the version is ngprogress 1.1.1.
read the source code and find that ngProgress.color('#fff') should be : ngProgress.setColor('#fff');
also .setHeight() instead of .height()

ngProgress.complete() produces "Error: Invalid argument" on IE8

My test code:

.controller("MyCtrl", function($window, $timeout, ngProgress) {
  ngProgress.start();
  $timeout(function() {
    $window.alert("Finished!");
    ngProgress.complete();
  }, 2000);
});

Produces the following error in IE8's console:

Error: Invalid argument

Unfortunately IE doesn't provide a line number or any other info. :(

Commenting out the ngProgress.complete(); line makes the error go away, so I'm fairly certain the blame lies with that function.

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.