michaelbromley / ngx-pagination

Pagination for Angular
http://michaelbromley.github.io/ngx-pagination/
MIT License
1.21k stars 243 forks source link

Angular Universal server side render pagination-controls #19

Closed wellingWilliam closed 7 years ago

wellingWilliam commented 8 years ago

Angular 2 version:

"angular2": "2.0.0-beta.12",

ng2-pagination version:

"ng2-pagination": "0.0.1",

Description of issue:

When using ng2-pagination with Angular Universal the pagination-control is not being rendered on the server side.

Steps to reproduce:

clone https://github.com/angular/universal-starter and add ng2-pagination

Expected result:

noJS navigation with the pagination-controls component

Actual result:

pagination-controls component templates are not rendered

Demo: (if possible, edit this Plunker demo and paste the link to your fork)

Any relevant code:

michaelbromley commented 8 years ago

Hi,

Thanks for the report. I've not yet tried using angular universal. Is there no error reported anywhere?

I'll take a look myself as soon as I get a bit of time.

wellingWilliam commented 8 years ago

No errors. Just did not prerender pagination-controls on server before sending to client. I am thinking it is due to not utilizing a router link for the controls. I did not save the work but could get a branch on a repo to demonstrate the behavior. You should easily be able to try it with Angular Universal.

megalepozy commented 8 years ago

I also use Universal and it does prerender for me but the links themselves don't have any href attribute so they look like the following: <a>4</a> (ex. is for the 4th page), which is a real problem from SEO point of view.

How can such a feature be implemented?

megalepozy commented 7 years ago

Update Angular 2.0 + Universal 2.0.11 + Ng2-pagination 0.5.1 does not prerender the pagination-controls element. When I was using Angular2 RC1 + Universal (dont remember the version but can check) + ng2-pagination 0.4.0 it did work.

I got no clue as to what is the issue

UPDATE Everything works as expected, it was a specific issue at my system

tabvn commented 7 years ago

If you are looking for simple pager (loading more ...) , let create your self Angular 2 loading pager https://www.youtube.com/watch?v=imvuVGiQiyA

michaelbromley commented 7 years ago

@tabvn It's not clear how that video relates to the matter at hand. As such it looks like spam. Please, keep spam off GitHub!

michaelbromley commented 7 years ago

I'm closing this issue since much has changed with both this module and with Angular Universal since it was created. Please re-open or file a new issue if further Universal issues are encountered.