Skip to main content

Loading directive

Loading directive provide a simple approach to switch templates when the loading state change. To work correctly the loading service must be provided by a component or module.

API

Inputs

InputTypeDefaultRequiredDescription
[ngxLoading]PropertyKey | PropertyKey[][]falseSet the loading state properties that will be observed
[ngxLoadingElse]TemplateRef | nullfalsefalseRender the custom loading template when loading is true

Example

import { ChangeDetectionStrategy, Component } from '@angular/core';
import { LoadingService } from 'ngx-reactive-loading';

@Component({
selector: 'app-root',
templateUrl: `./app.component.html`,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [LoadingService.componentProvider(['add'])],
})
class AppComponent {
constructor(private readonly loadingService: LoadingService) {}
}