Skip to main content
All docs
V23.2

Access a DashboardControl Instance in Angular

The sample below shows how you can access properties and call methods of a DashboardControl in an Angular application.

Pass a component name or a template reference variable to the @ViewChild decorator. Then use the component’s instance property to access the underlying DashboardControl and its members.

import { Component, ViewChild } from "@angular/core";
import { DxDashboardControlComponent } from 'devexpress-dashboard-angular';
// ...
export class AppComponent {
    // ===== Pass a component name =====
    @ViewChild(DxDashboardControlComponent, { static: false }) dashboardComponent: DxDashboardControlComponent
    // ===== or use a template reference variable =====
    @ViewChild("targetDashboardControl", { static: false }) dashboardComponent: DxDashboardControlComponent

    reloadData() {
        this.dashboardComponent.instance.reloadData();
    }

}