Hello to all, welcome again on therichpost.com. In this post, I will tell you, Angular 9 circle progress bar during api call.
Post Working:
In this post, I am showing progress bar loader in Angular 9 during API call.
Here is the working code snippet and please follow carefully:
1. Very first, here are common basics steps to add angular 9 application on your machine:
$ npm install -g @angular/cli
$ ng new angularloader // Set Angular 9 Application on your pc
cd angularloader // Go inside project folder
ng serve // Run project
http://localhost:4200/ //Check working Local server
Â
2. Now run below command into your terminal to include progress bar package into your angular 9 application:
npm install ng-circle-progress --save
Â
3. Now add below code into your app.module.ts file:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgCircleProgressModule } from 'ng-circle-progress';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule,
NgCircleProgressModule.forRoot({
// set defaults here
radius: 100,
outerStrokeWidth: 16,
innerStrokeWidth: 8,
outerStrokeColor: "#78C000",
innerStrokeColor: "#C7E596",
animationDuration: 300,
})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Â
4. Add, below code into your app.component.ts file:
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.
Hi. The duration value is hardcoded to [animationDuration]=”10000″ so yes the design is nice but I was expecting this circle progress bar to be displayed when I click on a button or something and to be displayed only while the app is loading. Do you have an updated version ? 😀
2 comments
Hi. The duration value is hardcoded to [animationDuration]=”10000″ so yes the design is nice but I was expecting this circle progress bar to be displayed when I click on a button or something and to be displayed only while the app is loading. Do you have an updated version ? 😀
Yes, I will make the new post and share link. Thank you.