Using API Methods
Our sample projects and report templates can help you learn the basics of working with our products.For finer control the viewer can be driven from Angular through a component reference, while the ASP.NET Core controller supplies the dashboard.
The controller backing the viewer.
How it works. The backend serves the dashboard while the Angular component reference lets application code invoke viewer API methods directly.
The controller backing the viewer.
[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);
}- The Angular component exposes the viewer instance, so its API methods (print, export, navigate) can be called from your own code.
- The controller's job stays the same — initialize the viewer and serve the dashboard on request.
How it works. The backend serves the dashboard while the Angular component reference lets application code invoke viewer API methods directly.