Open In App

Angular PrimeNG ProgressSpinner Custom

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 see how to use the ProgressSpinner Custom in Angular PrimeNG. We will also learn about the properties along with their syntaxes that will be used in the code.

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



Syntax:

<p-progressSpinner
    [style]="{...}"
    strokeWidth="..."
    fill="..."
    animationDuration="...">
</p-progressSpinner>

Angular PrimeNG ProgressSpinner Custom properties:



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:

 

ng serve --open

Example 1: Below is the example code that illustrates the use of Angular PrimeNG ProgressSpinner Custom.




<div style="text-align: center">
    <h2 style="color: green">GeeksforGeeks</h2>
    <h5>Angular PrimeNG ProgressSpinner Custom</h5>
  
    <p-progressSpinner
      [style]="{ width: '100px', height: '100px' }"
      styleClass="custom-spinner"
      strokeWidth="5"
      fill="lightgreen"
      animationDuration=".3s">
    </p-progressSpinner>
</div>




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




import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { ProgressSpinnerModule } 
    from 'primeng/progressspinner';
  
@NgModule({
  imports: [
    BrowserAnimationsModule,
    ProgressSpinnerModule,
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

Output:

 

Example 2: Below is another example code that illustrates Angular PrimeNG ProgressSpinner Custom using some other custom property values.




<div style="text-align: center">
    <h2 style="color: green">GeeksforGeeks</h2>
    <h5>Angular PrimeNG ProgressSpinner Custom</h5>
  
    <p-progressSpinner
        [style]="{ width: '75px', height: '75px' }"
        strokeWidth="10"
        fill="yellow"
        animationDuration="2s">
    </p-progressSpinner>
</div>




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




import { BrowserAnimationsModule } 
   from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { ProgressSpinnerModule } 
   from 'primeng/progressspinner';
  
@NgModule({
 imports: [
   BrowserAnimationsModule,
   ProgressSpinnerModule,
 ],
 declarations: [AppComponent],
 bootstrap: [AppComponent],
})
export class AppModule{}

Output:

 

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


Article Tags :