Open In App

Angular PrimeNG ProgressBar Static

Improve
Improve
Like Article
Like
Save
Share
Report

Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. This article will show us how to use the ProgressBar Static in Angular PrimeNG. We will also learn about the properties along with their syntaxes that will be used in the code.

The ProgressBar component is used to make a bar that displays the process status.

Syntax:

<p-progressBar
    [style]="{...}">
</p-progressBar>

Angular PrimeNG ProgressBar Static properties:

  • value: It specifies the current value of the progress. It accepts a number of data types, the default value is null.

Creating Angular application & module installation:

Step 1: Create an Angular application using the following command.

ng new appname

Step 2: After creating your project folder i.e. appname, move to it using the following command.

cd appname

Step 3: Install PrimeNG in your given directory.

npm install primeng --save
npm install primeicons --save

Project Structure: After complete installation, it will look like the following:

 

Run the below command to see the output:

ng serve --open

Example 1: Below is the example code that illustrates the use of Angular PrimeNG ProgressBar Static.

app.component.html




<div style="text-align: center">
  <h2 style="color: green">GeeksforGeeks</h2>
  <h5>Angular PrimeNG ProgressBar Static</h5>
  <p-progressBar></p-progressBar>
</div>


app.component.ts




import { Component } from '@angular/core';
import { MessageService } from 'primeng/api';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    providers: [MessageService],
})
  
export class AppComponent {}


app.module.ts




import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { ProgressBarModule } 
    from 'primeng/progressbar';
import { ToastModule } from 'primeng/toast';
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ProgressBarModule,
    ToastModule,
    FormsModule,
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
  
export class AppModule {}


Output:

 

Example 2: Below is another example code that illustrates the Angular PrimeNG ProgressBar Static using some styling properties.

app.component.html




<h2 style="color: green">GeeksforGeeks</h2>
<h5>Angular PrimeNG ProgressBar Static</h5>
  
<p-progressBar [style]="
        {
          'height': '10px', 
          'width': '300px'
        }">
</p-progressBar>


app.component.ts




import { Component } from '@angular/core';
import { MessageService } from 'primeng/api';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    providers: [MessageService],
})
  
export class AppComponent {}


app.module.ts




import { NgModule } from '@angular/core';
import { BrowserModule } 
    from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { ProgressBarModule } 
    from 'primeng/progressbar';
import { ToastModule } from 'primeng/toast';
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ProgressBarModule,
    ToastModule,
    FormsModule,
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
  
export class AppModule {}


Output:

 

Reference: https://primefaces.org/primeng/progressbar



Last Updated : 29 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads