rohit13807
rohit13807

Reputation: 595

How to show loading bar in angular 4

I am using angular 4. And trying to add loading bar, till I didn't get the response from the server side. When Request gets complete, it should not hide. For this I am using below code In module.ts:

import { NgProgressModule } from 'ngx-progressbar';
@NgModule({
imports: [
    NgProgressModule
]
)}

And in Html file I am using below:

<ng-progress [positionUsing]="'marginLeft'"
[direction]="'leftToRightIncreased'"
[color]="'#4286f4'" [trickleSpeed]="500" 
[thick]="true" [ease]="'easeInSine'" ></ng-progress>

Upvotes: 1

Views: 1505

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222700

In components, wherever you need the progress bar, you have to

import { NgProgress } from 'ngx-progressbar';

and

constructor(private ngProgress: NgProgress) { 
}

use start() and stop() as you need

this.ngProgress.start();

Upvotes: 1

Related Questions