All Projects → akserg → Ng2 Slim Loading Bar

akserg / Ng2 Slim Loading Bar

Licence: mit
Angular 2 component shows slim loading bar at the top of the page.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ng2 Slim Loading Bar

Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+681.91%)
Mutual labels:  progress, progress-bar, bar
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-93.09%)
Mutual labels:  progress, progress-bar, bar
Vue Wait
Complex Loader and Progress Management for Vue/Vuex and Nuxt Applications
Stars: ✭ 1,869 (+397.07%)
Mutual labels:  loading, progress, progress-bar
Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+81.38%)
Mutual labels:  progress, progress-bar, bar
Terminal layout
The project help you to quickly build layouts in terminal,cross-platform(一个跨平台的命令行ui布局工具)
Stars: ✭ 98 (-73.94%)
Mutual labels:  loading, progress, progress-bar
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (-53.99%)
Mutual labels:  loading, progress, progress-bar
CustomProgress
一款常见的进度条加载框架
Stars: ✭ 32 (-91.49%)
Mutual labels:  progress, progress-bar, loading
Tqdm
A Fast, Extensible Progress Bar for Python and CLI
Stars: ✭ 20,632 (+5387.23%)
Mutual labels:  progress, progress-bar
mp-progress
专注于小程序圆环形进度条的小工具
Stars: ✭ 72 (-80.85%)
Mutual labels:  progress, progress-bar
DottedProgressBar
Simple and powerful animated progress bar with dots
Stars: ✭ 40 (-89.36%)
Mutual labels:  progress, progress-bar
LineProgressbar
A light weight jquery progressbar plugin
Stars: ✭ 34 (-90.96%)
Mutual labels:  progress, progress-bar
Loading Bar
Flexible, light weighted and super fast Progress Bar Library
Stars: ✭ 300 (-20.21%)
Mutual labels:  loading, progress
Stateviews
Create & Show progress, data or error views, the easy way!
Stars: ✭ 367 (-2.39%)
Mutual labels:  loading, progress-bar
Qier Progress
💃 Look at me, I am a slim progress bar and very colorful / 支持彩色或单色的顶部进度条
Stars: ✭ 307 (-18.35%)
Mutual labels:  progress, progress-bar
GradientProgress
A gradient progress bar (UIProgressView).
Stars: ✭ 38 (-89.89%)
Mutual labels:  progress, progress-bar
Waitme
jquery plugin for easy creating loading css3/images animations
Stars: ✭ 302 (-19.68%)
Mutual labels:  loading, progress
CustomProgress
自定义水平带百分比数字的进度条以及自定义圆形带百分比数字的进度条
Stars: ✭ 58 (-84.57%)
Mutual labels:  progress, progress-bar
ProBar
this script will allow you to configure a progress bar with a timer with other options
Stars: ✭ 0 (-100%)
Mutual labels:  progress, progress-bar
plain-overlay
The simple library for customizable overlay which covers a page, elements or iframe-windows.
Stars: ✭ 28 (-92.55%)
Mutual labels:  progress, loading
VHProgressBar
Vartical and Horizontal ProgressBar
Stars: ✭ 23 (-93.88%)
Mutual labels:  progress, progress-bar

Angular 2 Slim Loading Bar npm version npm monthly downloads

Angular2 component shows slim loading bar at the top of the page of your application.

Build Status semantic-release Commitizen friendly Dependency Status devDependency Status Known Vulnerabilities

Follow me twitter to be notified about new releases.

Some of these APIs and Components are not final and are subject to change!

Installation

npm install ng2-slim-loading-bar --save

Demo

Simple examples using ng2-slim-loading-bar:

Online demo available here

Usage

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'
    }
});

1. Update the markup

  • Import the style.css file into your web page
  • Add <ng2-slim-loading-bar></ng2-slim-loading-bar> tag in template of your application component.

2. Import the 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 {
}

3. Use the SlimLoadingBarService for your application

  • Import SlimLoadingBarService 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();
    }
}

3. Customize the the ng2-slim-loading-bar for your application

You 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. It can be any CSS compatible value.
  • height - The height of loading bar. Default value is 2px.
  • show - The flag helps hide and show the loading bar. Default value is true.

Example: <ng2-slim-loading-bar color="blue" height="4px"></ng2-slim-loading-bar>

4. Manage the 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, false for hidden and true for visible.

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.

5. Events handling

You can hook up with our different types of events thrown.

  • SlimLoadingBarEventType.PROGRESS
  • SlimLoadingBarEventType.HEIGHT
  • SlimLoadingBarEventType.COLOR
  • SlimLoadingBarEventType.VISIBLE

you can subscribe to these events types by simplying doing this

 constructor(private _loadingBar: SlimLoadingBarService) {
    this._loadingBar.events.subscribe((item:SlimLoadingBarEvent) => console.log(item));
   }

where item returned is of SlimLoadingBarEvent {type: SlimLoadingBarEventType, value: any}

Credits

Inspired by ngProgress.js

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].