Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-side rendering error when imported into Angular Universal Starter #1144

Closed
dllabs opened this issue Nov 22, 2017 · 2 comments
Closed

Comments

@dllabs
Copy link

dllabs commented Nov 22, 2017

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

(It might be a documentation upgrade request rather than a bug report. In which case, I do apologise. I sought advice on StackOverflow but go no response there after more than a week, so I'm turning this into a bug report as a last resort.)

Current behavior

When ngx-datatable is imported into otherwise-unmodified Angular Universal Starter app (the one recently upgraded for Angular 5.0), it throws the following runtime error when run with server-side rendering:

dist\server.js:128395
__metadata("design:paramtypes", [Event]),

ReferenceError: Event is not defined

The server.js code it's referencing is from the DataTableBodyRowComponent of ngx-datatable:

__decorate([
  core_1.HostListener('mouseenter', ['$event']),
  __metadata("design:type", Function),
  __metadata("design:paramtypes", [Event]),
  __metadata("design:returntype", void 0)
], DataTableBodyRowComponent.prototype, "onMouseenter", null);

Expected behavior

Angular Universal Starter is a standard, often-recommended seed for Angular Universal apps. ngx-datatable should either work with it out of the box, OR the docs should be updated to explain what other changes need to be made.

Reproduction of the problem

  1. Clone Angular Universal Starter and install dependencies.

  2. build and run with npm run build:ssr && npm run serve:ssr. It runs fine.

  3. install ngx-datatable and import into app.module.ts as per the current documentation:

    ....        
    import { NgxDatatableModule } from '@swimlane/ngx-datatable';
    ....
    imports: [
      ....
      NgxDatatableModule
    ],
    
  4. run clientside with ng serve. It runs without errors.

  5. build and run serverside with npm run build:ssr && npm run serve:ssr. It throws the above error.

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Windows 10, Node 8.9.1

  • Table version: 11.0.4, 11.0.3
  • Angular version: 5.0.1
  • Browser: Node Express server performing server-side rendering. Not seeing the same error client-side.
  • Language: TypeScript 2.4.2
@amcdnl
Copy link
Contributor

amcdnl commented Nov 22, 2017

Pushed 11.1.3, give that a try

@dllabs
Copy link
Author

dllabs commented Nov 23, 2017

That solves the issue, thanks. ngx-datatable now runs out of the box on a server-side implementation of Angular Universal Starter.

@dllabs dllabs closed this as completed Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants