Good day,
I hope you can help me as I am battling getting the report viewer that is working well in another html/javascript project.
Now converting the application to Angular (8).
This loads the report viewer fine:
<tr-viewer #viewer1
[containerStyle]="viewerContainerStyle"
[serviceUrl]="http://localhost/RepService/ReportViewer/api/reports"
[templateUrl]="'http://localhost/RepService/ReportViewer/templates/telerikReportViewerTemplate.html'"
[viewMode]="'INTERACTIVE'"
[scaleMode]="'SPECIFIC'"
[scale]="1.0"
>
</tr-viewer>
But this would need to be reconfigured when deploying, so to do that, this get's the closest:
In html file:
<tr-viewer #viewer1
[containerStyle]="viewerContainerStyle"
[serviceUrl]="serviceUrl"
[templateUrl]="'http://localhost/RepService/ReportViewer/templates/telerikReportViewerTemplate.html'"
[viewMode]="'INTERACTIVE'"
[scaleMode]="'SPECIFIC'"
[scale]="1.0"
>
</tr-viewer>
In .ts file:
ngAfterViewInit() {
this.serviceUrl = "'http://localhost/RepService/api/reports/'";
But getting the following:
The serviceUrl is not specified.
When I move that line to ngOnInit:
ngOnInit() {
this.serviceUrl = "'http://localhost/XRSReportingService/api/reports/'";
Getting: Cannot access the Reporting REST service. (serviceUrl = ''http://localhost/XRSReportingService/api/reports/''). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)
So this doesn't look like a CORS issue to me.
Thanks very much