HNeukermans / ng2-signalr

angular2 - asp.net signalr library
MIT License
173 stars 81 forks source link

Angular 5 support #92

Closed andy- closed 6 years ago

andy- commented 7 years ago

Hello, i have migrated mi app from Angular 4 to Angular 5. I am getting this error:

Uncaught TypeError: WEBPACK_IMPORTED_MODULE_0__angular_core.OpaqueToken is not a constructor at eval (signalr.module.js:3) at Object.../../../../ng2-signalr/src/services/signalr.module.js (vendor.bundle.js:1566) at webpack_require (inline.bundle.js:55) at eval (signalr.js:5) at Object.../../../../ng2-signalr/src/services/signalr.js (vendor.bundle.js:1558) at webpack_require (inline.bundle.js:55) at eval (ng2-signalr.js:17) at Object.../../../../ng2-signalr/src/ng2-signalr.js (vendor.bundle.js:1494) at webpack_require (inline.bundle.js:55) at eval (webpack-internal:///../../../../ng2-signalr/index.js:1) at Object.../../../../ng2-signalr/index.js (vendor.bundle.js:1478) at webpack_require (inline.bundle.js:55) at eval (ops-notification.service.ts:7) at Object.../../../../../src/app/shared/services/ops-notification.service.ts (main.bundle.js:1502)

mcgri commented 7 years ago

I think it's a duplicate of #86

mcgri commented 7 years ago

@andy- as a temporary solution, you could try to run - "npm install pbriones/ng2-signalr"

andy- commented 7 years ago

@mcgri it worked! thanks!

stevencohn commented 7 years ago

Any advice on how to reference pbriones' version from package.json? npm install didn't like just the string shown above by mcgri so I tried adding this line to my package.json:

    "ng2-signalr": "git+https://github.com/pbriones/ng2-signalr.git",

which worked but cloned the source files. This caused the compiler to complain that index.ts wasn't included; I then tried to add it to the tsconfig files[] but that didn't seem to help.

So what's the best way to add this so a team can consume it easily? Thanks!

andy- commented 7 years ago

@stevencohn this worked on my team: "ng2-signalr": "github:pbriones/ng2-signalr" we use --aot flag to build and serve.

Floyd1256 commented 6 years ago

Hey guys after trying to install from the newer version of the library (pbriones' updated version), I am always getting a warning concerning angular/router. The thing is, if I check the version of angular/router, it says 3.10.10 which should be okay, but still the error persists. I am only getting the following warning: npm WARN ng2-signalr@2.1.1 requires a peer of @angular/router@>=3.0.0 || >= 5.0.0 but none was installed. However when I run the app, it is complaining about not finding index.js within the ng2-signalr folder. Any ideas on how to proceed?

itsikhar commented 6 years ago

Hey @Floyd1256 did you solved it? I have the same issue with my app..

sreekumarp commented 6 years ago

@itsikhar : for @andy- 's solution worked.... its temporary fix .... but I found a benfit here that,... all my team members will start using --aot with there development itself 🥇

https://github.com/HNeukermans/ng2-signalr/issues/92#issuecomment-343507355

itsikhar commented 6 years ago

Hey @sreekumarp, I can't use @andy- solution cause i'm working with Ionic and it doesn't support this flag.

Floyd1256 commented 6 years ago

Hey @itsikhar I actually had to transpile the downloaded module along with jquery and signalr libraries. If you get an error concerning jquery after that try to re-import it because that's what worked for me. Took me some time so I recommend waiting for the author's update if you're not in a hurry.

itsikhar commented 6 years ago

Hey @Floyd1256 , Thanks for your answer, For now I also decided to change my service to work with jQuery untill the author will update. Thank you :)

andy- commented 6 years ago

@itsikhar Ionic its by default aot compiled, but you can try npm run build --prod --aot

stevencohn commented 6 years ago

As mentioned in issue #86, this git repo has been updated to deal with OpaqueToken however it doesn't appear that this change has been published to npm yet. You can download this repo and build locally and install from the local dist folder. Or @HNeukermans could update npm! Please!?

CBXZero commented 6 years ago

Any update on getting this to npm? Ran into the same issue and would like to use the library

gabguy commented 6 years ago

Guys, please push this update to npm. We need it

sreekumarp commented 6 years ago

@HNeukermans : can you please publish it ?

zoharyosef commented 6 years ago

Joining to the request

Thanks

sreekumarp commented 6 years ago

temporary solution is to install it from github

npm install github:HNeukermans/ng2-signalr

it worked for me

OnlyAGhost commented 6 years ago

Trying to use either repository (trying to upgrade from Angular4 to Angular5) I'm getting this error:

Error: \node_modules\ng2-signalr\index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

Thanks!

srivathsah commented 6 years ago

+1

dharapvj commented 6 years ago

I forked and compiled and published this library as a temporary measure under different scope.. so that it becomes usable for Angular 5..

please use it as npm i @dharapvj/ngx-signalr. It will install v3.0.0 and you will not face the issue of OpaqueToken anymore.

Groverize commented 6 years ago

I personally gave up on this project and just learnt to implement it myself with the base JQuery approach... It's fairly easy to do yourself.

zoharyosef commented 6 years ago

@Groverize I also tried going jq, but i had funny issues with change detection...

dharapvj commented 6 years ago

Try my package once

On 23-Jan-2018 3:00 PM, "LeeroyMagic" notifications@github.com wrote:

@Groverize https://github.com/groverize I also tried going jq, but i had funny issues with change detection...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/HNeukermans/ng2-signalr/issues/92#issuecomment-359731605, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1PnqzYc56IJfneFrEAyzZSwffSjffkks5tNaaygaJpZM4QXFyx .

zoharyosef commented 6 years ago

@dharapvj I tried it it's excellent Thanks!

dharapvj commented 6 years ago

Ha!

Thanks..

I did not do anything..

I just cloned, did some quick edits to remove 'ng2' references and published it under my name.

Good to know that is working for others as well.

Cheers, VJ

On Tue, Jan 23, 2018 at 4:56 PM, LeeroyMagic notifications@github.com wrote:

@dharapvj https://github.com/dharapvj I tried it it's excellent Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/HNeukermans/ng2-signalr/issues/92#issuecomment-359761632, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1PnuDAUf84C9Fa9li-j1dns7VOKI5tks5tNcIEgaJpZM4QXFyx .

OnlyAGhost commented 6 years ago

@dharapvj works like a dream!!! Thank you so much for doing this!

abhijeet-gandhi commented 6 years ago

@dharapvj brao! Saved my day :)

thduttonuk commented 6 years ago

Angular 5 support has been published