Edmund: Take a look at http://jsfiddle.net/toddbadams/yYD7K/
It is a more complete pagination model/service that I put together to demonstrate server side pagination. Line 161 is a function called bind, where you pass it a paging object and a request. This then calls the request function when things change. The request function can be anything you would like, for example it calls $http. Hope this helps. Todd From: [email protected] [mailto:[email protected]] On Behalf Of Edmund Chan Sent: 07 May 2014 23:27 To: [email protected] Subject: [AngularJS] Re: Pagination in angularjs using bootstrap. On Wednesday, March 19, 2014 9:13:59 AM UTC-7, Todd Adams wrote: I wrote a pagination directive, that has a model and service with it. Here is the jsfiddle. http://jsfiddle.net/k49rD/ Todd On Tuesday, 18 March 2014 07:30:22 UTC, Deeksha Sharma wrote: Hello Everyone, I am trying to implement pagination but unable to do this .Can anybody give me a good link for understanding the concept of pagination in angularjs. Thanks in advance. Hello, Just wanted to say thanks for this bit of code. I hope you can point me in the right direction in using it. I'm a programmer, but not a JS progammers so I'm having a bit of trouble figuring out where things go. I hope you don't mind, I would like to ask a few questions. I'm looking at this code but I think it looks like maybe it is for Client side pagination. I don't see any $http call. Is that correct? If yes, am I wrong in thinking it would NOT be hard to convert to pull from a backend restful server? Maybe add the $http call? At any rate, maybe it will help me even if it is just for Client pagination. I just need to understand a bit more about it. I have a Laravel app that is working all in PHP. I want to make an API and would like to use ANGULAR for the front end to talk to the API. I currently have an ANGULAR frontend that is working. It pulls JSON data from the backend and I can display it with ANGULAR, but I need pagination. The way I have MY EXISTING CODE is like this: -------------------------------------------- index.php -- This is called when I hit the Restful Route. It is a regular PHP file. with my markup in it and a JS src link to main.js. -- main.js -- This is where I have my current Controller code and it is linked to from my index.php file. It makes the AJAX call to the Restful backend. -- MyController.php -- This is the Laravel PHP Controller that my main.js (ANGULAR Ajax controller) pulls data from. I don't believe MyController.php needs any changes really. ========= This code in the top window on JSFIDDLE with HTML and the ANGULAR directives is basically what I have in my index.php. Of course there is all the regular html markup and a <link...> to my main.js in my code. This is no problem. I understand it. ------------------------------------ So my question is this. Where would the code under this heading go? /***************************************************************** * ANGULAR APPLICATION ******************************************************************/ And where would the code under this heading go? Could I put an AJAX call where the "new Array()" line is so I can pull Server based paginated data? If so, how should I inject $http? Would I just put it in the "function" call after the factory declaration line or would this just not work with what you have? /***************************************************************** * ANGULAR EXPOSED ITEM SERVICE ******************************************************************/ This next bit of code under the following heading I believe is very much like my main.js (ANGULAR Controller) that is "linked" to from index.php. So my main.js is where my Controller code currently is. So this should replace my main.js. Is that correct? /***************************************************************** * ANGULAR EXPOSED MY APPLICATION CONTROLLER ************************************ Once again, thanks for the code and thanks in advance for any info or help you can provide. Edmund -- You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/Q1vLnx6aUNQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected]<mailto:[email protected]>. To post to this group, send email to [email protected]<mailto:[email protected]>. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout. .. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
