
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
ng-loading-bar
Advanced tools
A fully automatic loading bar with zero configuration for angular app (http, http-client and router).
@angular/common/http
requests.@angular/http
requests. # if you use `@angular/common/http`
npm install @ngx-loading-bar/http-client --save
# if you use `@angular/http`
npm install @ngx-loading-bar/http --save
# if you use `@angular/router`
npm install @ngx-loading-bar/router --save
# to manage loading-bar manually
npm install @ngx-loading-bar/core --save
LoadingBarHttpClientModule
, LoadingBarHttpModule
, LoadingBarRouterModule
or LoadingBarModule
):import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client';
// for Http import LoadingBarHttpModule:
// import { LoadingBarHttpModule } from '@ngx-loading-bar/http';
// for Router import LoadingBarRouterModule:
// import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
// for Core import LoadingBarModule:
// import { LoadingBarModule } from '@ngx-loading-bar/core';
import { AppComponent } from './app';
@NgModule({
...
imports: [
...
LoadingBarHttpClientModule
// for HttpClient use:
// LoadingBarHttpModule,
// for Router use:
// LoadingBarRouterModule
// for HttpClient use:
// LoadingBarHttpClientModule
// for Core use:
// LoadingBarHttpClientModule.forRoot()
],
})
export class AppModule {}
ngx-loading-bar
in your app component:import { Component } from '@angular/core';
@Component({
selector: 'app',
template: `
...
<ngx-loading-bar></ngx-loading-bar>
`,
})
export class AppComponent {}
LoadingBarModule
import { NgModule } from '@angular/core';
import { LoadingBarModule } from '@ngx-loading-bar/core';
@NgModule({
...
imports: [
...
LoadingBarModule.forRoot(),
],
})
export class AppModule {}
import { Component } from '@angular/core';
import { LoadingBarService } from '@ngx-loading-bar/core';
@Component({
selector: 'app',
template: `
...
<ngx-loading-bar></ngx-loading-bar>
<button (click)="startLoading()">start</button>
<button (click)="stopLoading()">stop</button>
`,
})
export class App {
constructor(private loadingBar: LoadingBarService) {}
startLoading() {
this.loadingBar.start();
}
stopLoading() {
this.loadingBar.complete();
}
}
When you import LoadingBarHttpModule, http service observables become hot. That means that a HTTP request is sent as soon as a call to http.get (for example) has been made.
import { Component } from '@angular/core';
import { Http } from '@angular/http';
@Component({
selector: 'ng-loading-bar-app',
templateUrl: './app.html',
})
export class App {
private request$;
constructor(private _http: Http) {
// http request is sent here
this.request$ = _http.get('/app/heroes');
}
startLoadingBarHttpRequest() {
if (false) {
// Request has been sent to server
this.request$.subscribe();
}
}
}
This behavior is because the Loading bar module overrides default http service by setting up a subscription to the request. This subscription fires up the HTTP request.
If this behavior doesn't suit you, you should manage loading bar manually as in the component startHttpRequest above.
FAQs
Automatic page loading / progress bar for Angular 2
The npm package ng-loading-bar receives a total of 6 weekly downloads. As such, ng-loading-bar popularity was classified as not popular.
We found that ng-loading-bar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.