Skip to main content
A newer version of this page is available. .
All docs
V20.2

Access a DashboardControl Instance

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();
    }

}