question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return to 1st page after new response returned by server

See original GitHub issue

=======

Angular version: 6

ngx-pagination version: 3.2.0

Description of issue: I have a search result page, and your awesome pagination at its bottom, at the top of this page is a search input. My problem is: after user navigate to other page (after the 1st page), let say 6th page… then the user input another search arguments at search input then submit… the page doesn’t return to the 1st page after new list of results rendered. I already emptied the array that caused the paging but still doesn’t changed.

Steps to reproduce:

Expected result: Expected result is: after user navigate to other page than 1st… when ever the array that generates the paging at in the first place is emptied … the paging will reset to the 1st page.

Actual result:

Demo: (http://hargadil.com/search?q=iphone x

Any relevant code:


Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bromoappcommented, Oct 17, 2018

Gorgeous… thanks

0reactions
michaelbromleycommented, Oct 16, 2018

Generally you shouldn’t need to inject the PaginationService. This is intended for internal use within the library, which is why it is not even documented.

It should be sufficient to bind to a variable on the component (p in the simple example) and in your ngOnChanges method above, do:

ngOnChanges() {
    this.p = 1;
    this.products = [];                                   // reset array that populate paging
    this.doSearch(this.arguments);                // initiate search request to API
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

continue processing php after sending http response
The problem is that I'm sending response to incomming "ID_OF_MESSAGE" , but server which send me message to handle will set his message...
Read more >
HTTP/1.1: Status Code Definitions
The server MUST send a final response after the request has been completed. ... The origin server MUST create the resource before returning...
Read more >
HTTP response status codes - MDN Web Docs - Mozilla
HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
Read more >
Rendering HTML Pages as an HTTP Server Response Using ...
The server is running. It is now returning HTML form as a response to the client (browser). Whenever this server's route is accessed,...
Read more >
Could not get any response when 204: No Content returned ...
Make a request which returns a 204, in this case, I'm making a POST request. Could not get any response displayed and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found