Angular LoadPanel - Show on Page Load
To display a LoadPanel on page load, initialize the component with visible set to true. You can hide the LoadPanel once your page or data finishes loading. The following code snippet demonstrates how to hide the component after ODataStore finishes loading data:
app.component.html
app.component.ts
- <dx-load-panel
- shadingColor="rgba(0,0,0,0.4)"
- [visible]="loadingVisible()"
- ></dx-load-panel>
- import { Component, signal } from '@angular/core';
- import { DxLoadPanelModule } from 'devextreme-angular/ui/load-panel';
- import ODataStore from 'devextreme/data/odata/store';
- @Component({
- // ...
- standalone: true,
- imports: [DxLoadPanelModule]
- })
- export class AppComponent {
- loadingVisible = signal(true);
- data = new ODataStore({
- url: 'http://www.example.com/Northwind.svc/Products'
- });
- constructor() {
- this.data.load().then(() => {
- this.loadingVisible.set(false);
- });
- }
- }
NOTE
In zoneless applications, Angular does not update the view when asynchronous code modifies class fields. Store data in signals and call
set() or update() to modify values. Refer to the following help topic for more information: Zoneless Change Detection - Asynchronous Code.