angularjs - how to get more items if page doesn't have scroll -


I call for more items by infinite scrolling, but it fails if initially loaded Items do not fill the screen. In this case, it means:

  document.body.scrollHeight == document.body.clientHeight  

on page The instructions work fine when the scroll bar works:

  app.directive ('infinitescroll', function ($ rootsecope, $ http, $ window) {return function ($ radius, $ element) { Angular.element ($ window) .bind (f To trigger the Ritchie client, scroll 'in the bottom of the page', function () {// 100 pixels gap hight = html.scrollHeight - 100; scrollHyat = html.scrollTop + document.query selector ('body'). ClientHigh;; (Client Height & Lt; = scrollHeight) {FEATURE ();}}); Function Fetcher () {// Get Last Item ID> + '/ Item /' + last id) then (function (feedback) // // pushing new item now $ sc scope}); }}});  

I can see in the controller if

  document.body.scrollHeight> gt; Call for other items, but this is a poor practice to check scrollhead in the controller, please let me know how to guide it up.   

I want to suggest creating a service for Fetaart, and I want to put it in the instruction. Your Fetcher can be a function in which you can pass the ID and it will request backend and return the response, you can inject it in your instructions, in the instructions: you can You can create instructions and set body characteristics as follows:

   

In this way, you will have the element in the directory that is already wrapped in jQuery and you need to do the document.querySelector ('body') is not. After you calculate, you can get your data from the server and send it to the controller you have $ emit or $ boradcast


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -