BTMorton / angular2-grid

A drag/drop/resize grid-based plugin directive for angular2
https://bmorton.co.uk/angular/
MIT License
354 stars 159 forks source link

Upgrade to Angular 6 #295

Closed bruiztorres closed 5 years ago

bruiztorres commented 6 years ago
ThomasSchellenbergNextCentury commented 6 years ago

Hey Borga, thanks for the PR! I can see that the demo is working, but when I try to use your updated branch in my app, I get the following console error:

Error: StaticInjectorError(AppModule)[NgGridItem -> KeyValueDiffers]: 
  StaticInjectorError(Platform: core)[NgGridItem -> KeyValueDiffers]: 
    NullInjectorError: No provider for KeyValueDiffers!

Have you seen the same? Any ideas what I might be doing wrong? (I'm not using KeyValueDiffers in my app, so this is from angular2-grid.) Thanks!

bruiztorres commented 6 years ago

At this point, I haven’t been able to reproduce the error you mentioned above.

@ThomasSchellenbergNextCentury I found an issue in stackoverflow that could be related. Could you try to do a fresh installation removing the node_modules folder.

In any case, I will dig into the issue trying to reproduce it.

bruiztorres commented 6 years ago

@ThomasSchellenbergNextCentury Could you let me know the way you are using this branch? I have played with different scenarios and haven't been able to reproduce the error you mentioned above.

ThomasSchellenbergNextCentury commented 6 years ago

Hey @borgitas21 ,

Sorry, I fixed my problem and meant to post about it but forgot!

The stackoverflow issue you linked helped a lot. My problem was due to the way I had imported the dependency into my project included a second node_modules folder. I fixed the problem by committing the updated code to a deployment branch on my fork (without the node_modules folder).

Thanks for your help and for checking-in!

Thomas

bruiztorres commented 6 years ago

Great, good to know ;)

fmontes commented 6 years ago

Any updated on this?

mronus commented 6 years ago

@BTMorton any update on this? This is really a great library; however it is sad that it prevents us from migrating our project from Angular 4 to Angular 6, and only angular2-grid among among 54 libraries that we use for our project has no support for Angular 6. We look forward to any update on this. Thanks in advance.

bruiztorres commented 5 years ago

@BTMorton are you missing something in this PR? Please let me know if I can help to merge it.

ncvanleeuwen commented 5 years ago

@BTMorton We have the same issue with this library. It's wonderful and we're using it for quite some time now but it's sad that it's broken with Angular 6. This means that we have to drop the functionality which depends on this library because we have to upgrade to Angular 6 for other reasons.

If you need help completing this PR please let me know!

mronus commented 5 years ago

I found an ugly workaround. It is useful at least till we get an upgrade for angular2-grid.

  1. First install replace as dev dependency. npm install replace --save-dev

  2. Create a bash script file (eg. angular2-grid-fix.sh) in the same dir with package.json file, and copy/paste the following content to bash script file.

    ./node_modules/replace/bin/replace.js 'import { Observable } from "rxjs/Observable"' 'import { fromEvent } from "rxjs"' ./node_modules/angular2-grid/directives/NgGrid.js
    ./node_modules/replace/bin/replace.js 'import "rxjs/add/observable/fromEvent";' '' ./node_modules/angular2-grid/directives/NgGrid.js
    ./node_modules/replace/bin/replace.js 'Observable.fromEvent' 'fromEvent' ./node_modules/angular2-grid/directives/NgGrid.js
  3. Add the following line to scripts entry in package.json file. "postinstall": "./angular2-grid-fix.sh"

Edit: The solution above might cause some problems across different operating systems due to file separator. So, instead of bash script, You can create a node file called "angular2-grid-fix.js" within the same directory with package.json file with the following content:

var replace = require("replace");

replace({
  regex: 'import { Observable } from "rxjs/Observable"',
  replacement: 'import { fromEvent } from "rxjs"',
  paths: ['./node_modules/angular2-grid/directives/NgGrid.js'],
  silent: false
});

replace({
  regex: 'import "rxjs/add/observable/fromEvent";',
  replacement: '',
  paths: ['./node_modules/angular2-grid/directives/NgGrid.js'],
  silent: false
});

replace({
  regex: 'Observable.fromEvent',
  replacement: 'fromEvent',
  paths: ['./node_modules/angular2-grid/directives/NgGrid.js'],
  silent: false
});

Then you can add it to the scripts entry in package.json file. So it is executed automatically after npm install is completed.

"postinstall": "node ./angular2-grid-fix.js"

@BTMorton please save us from such ugly workarounds.

mronus commented 5 years ago

@BTMorton 's last activity in GitHub was on 31st Aug. I hope he didn't leave the World.

bruiztorres commented 5 years ago

@BTMorton 's last activity in GitHub was on 31st Aug. I hope he didn't leave the World.

Hopefully, He is ok :)

BTMorton commented 5 years ago

Not dead, just burn out. v3.0.0 with full angular v6 support published.

mronus commented 5 years ago

@BTMorton You are the MAN. Thanks a lot.