Skip to content

Hey ,There is a bug!~ #11

@kengric

Description

@kengric

Code To:
SlimLoadingBarService.start(()=>{alert("complete!")});
When I run the code ,it start ok but can't get my completed status like the "complete!";
I check your slim-loading-bar.service.js code on ng2-slim-loading-bar@4.0.0.
it does not has the function to onComplete ,
then i fix it simple and the code is down:

SlimLoadingBarService.prototype.start = function (onCompleted) {
var _this = this;
if (onCompleted === void 0) {
onCompleted = null;
}else
this.onCompleted=onCompleted;

// Stop current timer
this.stop();
// Make it visible for sure
this.visible = true;
// Run the timer with milliseconds iterval
this._intervalCounterId = setInterval(function () {
// Increment the progress and update view component
_this.progress++;
// If the progress is 100% - call complete
if (_this.progress === 100) {
_this.complete();
}
}, this.interval);
};
SlimLoadingBarService.prototype.complete = function () {
var _this = this;
this.progress = 100;
this.stop();
setTimeout(function () {
// Hide it away
_this.visible = false;
setTimeout(function () {
// Drop to 0
_this.progress = 0;
}, 250);
}, 250);
this.onCompleted();
};
SlimLoadingBarService.prototype.onCompleted = function () {
};

thanks for your giving!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions