Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ng2-slim-loading-bar
Advanced tools
Readme
Angular2 component shows slim loading bar at the top of the page of your application.
Follow me to be notified about new releases.
Some of these APIs and Components are not final and are subject to change!
npm install ng2-slim-loading-bar --save
Simple examples using ng2-slim-loading-bar:
Online demo available here
If you use SystemJS to load your files, you might have to update your config:
System.config({
map: {
'ng2-slim-loading-bar': 'node_modules/ng2-slim-loading-bar/bundles/index.umd.js'
}
});
style.css
into your web page<ng2-slim-loading-bar></ng2-slim-loading-bar>
tag in template of your application component.SlimLoadingBarModule
Import SlimLoadingBarModule.forRoot()
in the NgModule of your application.
The forRoot
method is a convention for modules that provide a singleton service.
import {BrowserModule} from "@angular/platform-browser";
import {NgModule} from '@angular/core';
import {SlimLoadingBarModule} from 'ng2-slim-loading-bar';
@NgModule({
imports: [
BrowserModule,
SlimLoadingBarModule.forRoot()
],
bootstrap: [AppComponent]
})
export class AppModule {
}
If you have multiple NgModules and you use one as a shared NgModule (that you import in all of your other NgModules),
don't forget that you can use it to export the SlimLoadingBarModule
that you imported in order to avoid having to import it multiple times.
@NgModule({
imports: [
BrowserModule,
SlimLoadingBarModule.forRoot()
],
exports: [BrowserModule, SlimLoadingBarModule],
})
export class SharedModule {
}
SlimLoadingBarService
for your applicationSlimLoadingBarService
from ng2-slim-loading-bar
in your application code:import {Component} from '@angular/core';
import {SlimLoadingBarService} from 'ng2-slim-loading-bar';
@Component({
selector: 'app',
template: `
<div>Hello world</div>
<button (click)="startLoading()">Start Loading</button>
<button (click)="stopLoading()">Stop Loading</button>
<button (click)="completeLoading()">Complete Loading</button>
<ng2-slim-loading-bar></ng2-slim-loading-bar>
`
})
export class AppComponent {
constructor(private slimLoadingBarService: SlimLoadingBarService) { }
startLoading() {
this.slimLoadingBarService.start(() => {
console.log('Loading complete');
});
}
stopLoading() {
this.slimLoadingBarService.stop();
}
completeLoading() {
this.slimLoadingBarService.complete();
}
}
ng2-slim-loading-bar
for your applicationYou can use the following properties to customize the ng2-slim-loading-bar
component in your template:
color
- The color of loading bar. Default is firebrick
. Any CSS compatible value.height
- The height of loading bar. Default value is 2px
.show
- The flag helps hide and show the loading bar. Devault value is true
.Example:
<ng2-slim-loading-bar [color]="'blue'" [height]="'4px'"></ng2-slim-loading-bar>
You can use the following properties to customize the SlimLoadingBar via instance of SlimLoadingBarService:
color
- The color of loading bar.height
- The height of loading bar.visible
- The flag helps hide and show the loading bar.You can use the following methods to control the SlimLoadingBar via instance of SlimLoadingBarService:
start
- Start the loading progress. Use the callback function as an parameter to listed the complete event.stop
- Stop the loading progress. This method pause the current position of loading progress.reset
- Reset the position of loading progress to 0.complete
- Set the progress to 100% and hide the progress bar.Inspired by ngProgress.js
FAQs
Angular2 component shows slim loading bar at the top of the page
The npm package ng2-slim-loading-bar receives a total of 951 weekly downloads. As such, ng2-slim-loading-bar popularity was classified as not popular.
We found that ng2-slim-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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.