Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions build/ngprogress.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
ngprogress 1.1.2 - slim, site-wide progressbar for AngularJS
ngprogress 1.1.3 - slim, site-wide progressbar for AngularJS
(C) 2013 - Victor Bjelkholm
License: MIT
Source: https://github.com/VictorBjelkholm/ngProgress
Date Compiled: 2015-07-27
Date Compiled: 2016-10-02
*/
angular.module('ngProgress.provider', ['ngProgress.directive'])
.service('ngProgress', function () {
'use strict';
return ['$document', '$window', '$compile', '$rootScope', '$timeout', function($document, $window, $compile, $rootScope, $timeout) {
this.autoStyle = true;
this.count = 0;
this.height = '2px';
this.height = '2px';
this.$scope = $rootScope.$new();
this.color = 'firebrick';
this.parent = $document.find('body')[0];
Expand Down Expand Up @@ -41,6 +41,7 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
// TODO Use requestAnimationFrame instead of setInterval
// https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame
this.show();
this.progressbarEl.addClass(this.progressElementClass);
var self = this;
clearInterval(this.intervalCounterId);
this.intervalCounterId = setInterval(function () {
Expand Down Expand Up @@ -84,6 +85,14 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
}
}
return this.color;
};
// Add custome CLASS (juste while progress) to progressbarEl element (like as background..). Use any valid HTML (fix problems with timeout...)
// css
this.addProgressElementClass = function(new_class) {
if (new_class !== undefined) {
this.progressElementClass = new_class;
this.progressbarEl.addClass(new_class);
}
};
this.hide = function() {
this.progressbarEl.children().css('opacity', '0');
Expand All @@ -94,6 +103,7 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
self.show();
}, 500);
}, 500);
this.progressbarEl.removeClass(this.progressElementClass) //remove added class
};
this.show = function () {
var self = this;
Expand Down
6 changes: 3 additions & 3 deletions build/ngprogress.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ ngProgress.setHeight('10px');
ngProgress.setColor('#fff');
```

* **addProgressElementClass** - Adds custom class to base element, while it's progressing (#ngProgress-container)

```javascript
ngProgress.addProgressElementClass('my-class');
```

* **status** - Returns on how many percent the progressbar is at. Should'nt be needed

```javascript
Expand Down
12 changes: 11 additions & 1 deletion src/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
return ['$document', '$window', '$compile', '$rootScope', '$timeout', function($document, $window, $compile, $rootScope, $timeout) {
this.autoStyle = true;
this.count = 0;
this.height = '2px';
this.height = '2px';
this.$scope = $rootScope.$new();
this.color = 'firebrick';
this.parent = $document.find('body')[0];
Expand Down Expand Up @@ -35,6 +35,7 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
// TODO Use requestAnimationFrame instead of setInterval
// https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame
this.show();
this.progressbarEl.addClass(this.progressElementClass);
var self = this;
clearInterval(this.intervalCounterId);
this.intervalCounterId = setInterval(function () {
Expand Down Expand Up @@ -78,6 +79,14 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
}
}
return this.color;
};
// Add custome CLASS (juste while progress) to progressbarEl element (like as background..). Use any valid HTML (fix problems with timeout...)
// css
this.addProgressElementClass = function(new_class) {
if (new_class !== undefined) {
this.progressElementClass = new_class;
this.progressbarEl.addClass(new_class);
}
};
this.hide = function() {
this.progressbarEl.children().css('opacity', '0');
Expand All @@ -88,6 +97,7 @@ angular.module('ngProgress.provider', ['ngProgress.directive'])
self.show();
}, 500);
}, 500);
this.progressbarEl.removeClass(this.progressElementClass) //remove added class
};
this.show = function () {
var self = this;
Expand Down