In my loader.component.ts file, I have defined the selector as <app-loader>
.
The <app-loader>
tag is located in the main-component.html file and is displaying correctly.
<app-loader *ngIf="!showLoader === true">
I want the loader to only appear when I am fetching data.
Here is the code I am using to fetch data:
showLoader = true;
ngOnInit() {
this.httpService.getOffer()
.subscribe(
data => this.offers = data
)
this.showLoader = false;
}
Even though I have set the showLoader variable to true and then false after fetching the data, it is not working as expected. What could be the issue?