Integrating the Dashboards Viewer into an Application
Our sample projects and report templates can help you learn the basics of working with our products.The Angular dashboard viewer is backed by an ASP.NET Core controller: it initializes the viewer, serves the dashboard, and handles viewer events.
Initialize the viewer and serve the dashboard.
How it works. The Angular
Initialize the viewer and serve the dashboard.
[HttpPost]
public IActionResult InitViewer()
{
var requestParams = StiAngularViewer.GetRequestParams(this);
var options = new StiAngularViewerOptions();
options.Actions.GetReport = "GetReport";
options.Actions.ViewerEvent = "ViewerEvent";
return StiAngularViewer.ViewerDataResult(requestParams, options);
}
public IActionResult GetReport()
{
var report = StiReport.CreateNewReport();
report.Load(StiAngularHelper.MapPath(this, "Reports/HotelRevenue.mrt"));
return StiAngularViewer.GetReportResult(this, report);
}StiAngularViewer.ViewerDataResult(requestParams, options)— theInitVieweraction that configures the Angular viewer.Actions.GetReport/ViewerEvent— name the controller actions the viewer calls for the dashboard and for events.GetReportResult(this, report)— returns the loaded dashboard to the Angular component.
How it works. The Angular
sti-viewer component talks to these controller actions, so the dashboard is served and driven entirely through the .NET backend.