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

Pagination component not working with Universal #1578

Closed
ferares opened this issue Jan 31, 2017 · 4 comments
Closed

Pagination component not working with Universal #1578

ferares opened this issue Jan 31, 2017 · 4 comments

Comments

@ferares
Copy link

ferares commented Jan 31, 2017

This line on pagination.component:

this.classMap = this.elementRef.nativeElement.getAttribute('class') || '';

Seems to break Universal with the following error:

TypeError: this.elementRef.nativeElement.getAttribute is not a function

see: https://github.com/angular/universal-starter#universal-gotchas

@valorkin
Copy link
Member

do you have a working sample of ng2bs with universal?

@ferares
Copy link
Author

ferares commented Feb 1, 2017

@valorkin

https://github.com/ferares/ng2bootstrap-universal-pagination-issue

npm start to run it, it runs on port 3000

It has 2 views:

Home: without pagination - universal works
Issue: with pagination - universal doesn't work

You can check universal is working by viewing the source code deliver to the browser

@EivindArvesen
Copy link

EivindArvesen commented Mar 29, 2017

I have the same problem. It can be fixed with a check to make sure the code only executes on the browser, e.g. if (typeof window !== 'undefined') ....
This has worked for us in many cases.

Could you update ng2-bootstrap pagination to reflect this? Thanks

@IlyaSurmay
Copy link
Contributor

Fixed in #2925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants