Angular PrimeNG ProgressBar Component
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 progressBar component in Angular PrimeNG. We will also learn about the properties, styling along with their syntaxes that will be used in the code.
ProgressBar component: It is used to make a bar that displays the process status.
- value: It specifies the current value of the progress. It accepts a number data type, the default value is null.
- showValue: It specifies whether to show or hide progress bar value. It is of the boolean data type, the default value is true.
- unit: It specifies the Unit sign appended to the value. It is of string data type, the default value is %.
- mode: It specifies the mode of the progress, the valid values are “determinate” and “indeterminate”. It is of string data type, the default value is determinate.
- p-progressbar: It is the container element.
- p-progressbar-determinate: It is the container element of a determinate progressbar.
- p-progressbar-indeterminate: It is the container element of an indeterminate progressbar.
- p-progressbar-value: It is the element whose width changes according to value.
- p-progressbar-label: It is the label element that displays the current value.
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.
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 illustrates how to use the ProgressBar component.
Example 2: In this example, we will make the dynamic progressbar component that will update randomly along with displaying with & without the progress status value.