1
I would like to know how to implement a database paging logic using mysql and angular on the front end with ui-bootstrap or dirPagination. For example, taking 10 out of 10 in the bank using LIMIT and OFFSET. My doubt is in the implementation of logic at the front end. It can be a simple explanation and some example.
Since it’s an API, I’m not sure about endpoints either. Would they look like the examples below? I’d like an example as well.
GET /recursos?offset=10&limit=10
GET /recursos/limit/:limit/offset/:offset
It worked, @Giovane, thank you. It’s just bringing a little more record, but it must be some error in my logic, I did using dirPagination because I couldn’t use ng-table. How do I add the total of items in the json answer? I’m using Node.js and the return is like this:
return res.status(200).json(result);– Fernando Zabin
Query with a Count after doing it paged. So you will have the total number of records, then in return send an object with the total and the paged results. Ex:
return res.status(200).json({ total: countResult, conteudo: 'result' });– Giovane
Output result as string pq my cel auto corrected. result is your result object.
– Giovane