Open In App

Angular ngx Bootstrap Progressbar Component

Angular ngx bootstrap is a bootstrap framework used with angular to create components with great styling and this framework is very easy to use and is used to make responsive websites.

In this article, we will know how to use Progressbar in angular ngx bootstrap. Progressbar is used to provide up-to-date feedback on the progress of the work.



Installation syntax:

npm install ngx-bootstrap --save 

Approach:



Example:




<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="utf-8" />
    <base href="/" />
    <meta name="viewport" content=
        "width=device-width, initial-scale=1" />
    <link href=
        rel="stylesheet" />
  
    <link rel="icon" type="image/x-icon" href="favicon.ico" />
    <link rel="preconnect" href="https://fonts.gstatic.com" />
    <link href=
        rel="stylesheet" />
        rel="stylesheet" />
</head>
  
<body class="mat-typography">
    <app-root></app-root>
</body>
  
</html>




<div class="column">
    <div class="col-sm-4">
        <div class="mb-2">
            <progressbar [max]="100" [value]="27" 
                type="success" [striped]="true" 
                [animate]="true">27
            </progressbar>
        </div>
    </div>
  
    <br />
  
    <div class="col-sm-4">
        <div class="mb-2">
            <progressbar [max]="140" [value]="49" 
                type="warning" [animate]="true" 
                [striped]="true">49%
            </progressbar>
        </div>
    </div>
  
    <br />
  
    <div class="col-sm-4">
        <div class="mb-2">
            <progressbar [max]="140" [value]="40" 
                type="danger" [striped]="true" 
                [animate]="true">
                166 / 200
            </progressbar>
        </div>
    </div>
</div>




import { NgModule } from '@angular/core';
  
// Importing forms module
import { FormsModule, ReactiveFormsModule }
    from '@angular/forms';
import { BrowserModule }
    from '@angular/platform-browser';
import { BrowserAnimationsModule }
    from '@angular/platform-browser/animations';
import { ProgressbarModule }
    from 'ngx-bootstrap/progressbar';
  
import { AppComponent } from './app.component';
  
@NgModule({
    bootstrap: [
        AppComponent
    ],
    declarations: [
        AppComponent
    ],
    imports: [
        FormsModule,
        BrowserModule,
        BrowserAnimationsModule,
        ReactiveFormsModule,
        ProgressbarModule.forRoot()
    ]
})
export class AppModule { }




.column{
    margin: 30px;
}




import { Component, OnInit,LOCALE_ID } from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
}

Output:


Article Tags :