Angular PrimeNG ProgressSpinner Basic
Last Updated :
23 Aug, 2022
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 Basic 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
strokeWidth="..."
fill="...">
</p-progressSpinner>
Angular PrimeNG ProgressSpinner Basic 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.
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:
- 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 ProgressSpinner Basic.
app.component.html
< div style = "text-align: center" >
< h2 style = "color: green" >GeeksforGeeks</ h2 >
< h5 >Angular PrimeNG ProgressSpinner Basic</ h5 >
< p-progressSpinner ></ p-progressSpinner >
</ div >
|
app.component.ts
import { Component } from '@angular/core' ;
@Component({
selector: 'app-root' ,
templateUrl: './app.component.html' ,
styleUrls: [ 'app.component.scss' ]
})
export class AppComponent {}
|
app.module.ts
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 Basic using strokeWidth and fill properties.
app.component.html
< div style = "text-align: center" >
< h2 style = "color: green" >GeeksforGeeks</ h2 >
< h5 >Angular PrimeNG ProgressSpinner Basic</ h5 >
< p-progressSpinner
strokeWidth = "5"
fill = "green" >
</ p-progressSpinner >
</ div >
|
app.component.ts
import { Component } from '@angular/core' ;
@Component({
selector: 'app-root' ,
templateUrl: './app.component.html' ,
styleUrls: [ 'app.component.scss' ]
})
export class AppComponent{}
|
app.module.ts
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
Share your thoughts in the comments
Please Login to comment...