Open In App

Angular PrimeNG ProgressSpinner Component

Last Updated : 08 Sep, 2021
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. In this article, we will know how to use the ProgressSpinner component in Angular PrimeNG. We will also learn about the properties, styling along with their syntaxes that will be used in the code. 

ProgressSpinner: This component is used to make a spinner that illustrates the process status.

Properties:

  • strokeWidth: It specifies the width of the circle stroke. It accepts a string data type as input & the default Value is 2.
  • fill: It specifies the color for the background of the circle. It is of string data type, the default value is null.
  • animationDuration: It specifies the duration of the rotate animation. It is of string data type, the default value is 2s.

Styling:

  • p-progress-spinner: it is the container element.
  • p-progress-circle: it is the SVG styling element.
  • p-progress-path: It is the circle styling element.

 

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. app name, 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:

 

Example 1: This is the basic example that shows how to use the ProgressSpinner component.

app.component.html




<h2>GeeksforGeeks</h2>
<h5>PrimeNg ProgressSpinner Component</h5>
<p-progressSpinner></p-progressSpinner>


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 { ProgressSpinnerModule } 
    from 'primeng/progressspinner';
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ProgressSpinnerModule,
    FormsModule
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}


app.component.ts




import { Component } from '@angular/core';
  
@Component({
  selector: 'my-app',
  templateUrl: './app.component.html'
})
export class AppComponent {}


Output:

Example 2: In this example, we will use strokeWidth, fill and animationduration properties in the progressSpinner Component.

app.component.html




<h2>GeeksforGeeks</h2>
<h5>PrimeNG ProgressSpinner Component</h5>
<p-progressSpinner strokeWidth="5" fill="#03fc24" 
                   animationDuration="1s"></p-progressSpinner>


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 { ProgressSpinnerModule } from 'primeng/progressspinner';
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ProgressSpinnerModule,
    FormsModule
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}


app.component.ts




import { Component } from '@angular/core';
  
@Component({
  selector: 'my-app',
  templateUrl: './app.component.html'
})
export class AppComponent {}


Output: 

Reference: https://primefaces.org/primeng/showcase/#/progressspinner



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads