Setup Stimulsoft with Angular 5

Stimulsoft Reports.JS discussion
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Setup Stimulsoft with Angular 5

Post by mrapi »

Hi.
I'm looking for a way to use Stimulsoft with a Angular + Asp Core project
In my existing project I've run

Code: Select all

npm install stimulsoft-reports-js
I've found this Angular sample: https://github.com/stimulsoft/Samples-J ... t%20viewer
that seems to be for Angular 4 but latest stable version is 5 where are couple changes regarding Http '@angular/http'
now it is HttpClient ('@angular/common/http') and the code no longer works for me,got this error:

Code: Select all

Argument of type is not assignable to parameter of type 'HttpRequest<any>'
on this line:

Code: Select all

  this.http.request('reports/Report.mdc').subscribe((data: Response) => {..
any fix for tat?
thanks
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Setup Stimulsoft with Angular 5

Post by mrapi »

I've test publish with latest designer version 2018.2.2 and export is done for angular 4.0
package.json.json:

Code: Select all

 
...............
 "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
.....
using that code with latest version gives me that error:

Code: Select all

ERROR Error: StaticInjectorError(AppModule)[EditComponent -> Http]: 
  StaticInjectorError(Platform: core)[EditRezComponent -> Http]: 
    NullInjectorError: No provider for Http!
    at _NullInjector.get (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2013)
    at resolveToken (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2311)
    at tryResolveToken (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2253)
    at StaticInjector.get (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2121)
    at resolveToken (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2311)
    at tryResolveToken (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2253)
    at StaticInjector.get (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:2121)
    at resolveNgModuleDep (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:11865)
    at NgModuleRef_.get (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:13098)
    at resolveDep (vendor.js?v=9Ivn16CMraJlulcDOIp1N98O9BUnv5K4GBK8W_BziXw:13588)
thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Setup Stimulsoft with Angular 5

Post by HighAley »

Hello.

We can't reproduce the issue with publishing.
Could you send us a sample of what you get?

We will try to create a sample project with Angular 5.

Thank you.

Ticket reference: #6117
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Setup Stimulsoft with Angular 5

Post by mrapi »

hi

attached file it is a webpack project+asp core
Attachments
Angular5Core2.zip
(3.79 MiB) Downloaded 1186 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Setup Stimulsoft with Angular 5

Post by HighAley »

Hello.

We have created a sample for Angular5.
angular5.zip
(3.07 MiB) Downloaded 575 times
We will make necessary changes in the Publish feature.

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Setup Stimulsoft with Angular 5

Post by mrapi »

Hi.thanks for your answer

my project is based on webpack,using your code I've got t ReferenceError: Stimulsoft is not defined:

Code: Select all

SchComponent.html:131 ERROR ReferenceError: Stimulsoft is not defined
    at EditRezComponent.ngOnInit (edit-rez.component.ts:116)
    at checkAndUpdateDirectiveInline (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:20660)
    at checkAndUpdateNodeInline (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:22184)
    at checkAndUpdateNode (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:22127)
    at debugCheckAndUpdateNode (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:23020)
    at debugCheckDirectivesFn (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:22961)
    at Object.eval [as updateDirectives] (SchComponent.html:131)
    at Object.debugUpdateDirectives [as updateDirectives] (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:22946)
    at checkAndUpdateView (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:22093)
    at callViewAction (vendor.js?v=Gl_Wz-bW9PAUbMRuBpaAt69ZISzBxTDQSUKoN28QJdw:22444)
thanks
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Setup Stimulsoft with Angular 5

Post by mrapi »

Aslo I've put stimulsoft folder (with stimulsoft.reports.js,stimulsoft.viewer.js,stimulsoft.designer.js) in node_module then in webpack.config.vendor.js I've added:

Code: Select all

const nonTreeShakableModules = [
   ............
	"stimulsoft/stimulsoft.reports.js",
	"stimulsoft/stimulsoft.viewer.js",
	"stimulsoft.designer.js"
];
+ recompiled with webpack : webpack --config webpack.config.vendor.js
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Setup Stimulsoft with Angular 5

Post by Lech Kulikowski »

Hello,

Is the issue was resolved?

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Setup Stimulsoft with Angular 5

Post by mrapi »

Hi.no,the same error as above:
ERROR ReferenceError: Stimulsoft is not defined
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Setup Stimulsoft with Angular 5

Post by Lech Kulikowski »

Hello,

We compile our references with Angular cli and specify scripts in .angular-cli.json file
You should configure references in the webpack.

Thank you.
Post Reply