Completed
Last Updated: 20 Jun 2019 13:18 by ADMIN
Bob
Created on: 13 May 2019 10:54
Type: Bug Report
1
Angular Report Viewer Report Source Update throws an error

Using the following code for updating the ReportSource of the viewer:

ngOnInit() {
  this.setParameters();
}

setParameters(): void {
  this.reportViewer.setReportSource({
    report: 'SampleReport.trdp',
    parameters: {}
  });
}

comes up with the error 

Argument of type '{ report: string; }' is not assignable to parameter of type 'JSON'.
  Type '{ report: string; }' is missing the following properties from type 'JSON': parse, stringify, [Symbol.toStringTag]

Currently, the workaround is to cast the reportSource object as follows:

ngAfterViewInit() {
  this.setReportSource();
}
 
setReportSource(): void {
  let rs = {
    report: 'SampleRepport.trdp',
    parameters: {}
  } as unknown as JSON;
  this.viewer.setReportSource(rs);
}


0 comments