Infinite-scroll from remote json file


#1

Hi,
I just can’t figure how to implement infinite scroll for results from remote json file. The file pull results from MySql database with php and output json file. I menaged to get results and also on “pull-refresh” to add new items if they are available, but I can’t get all 24 results and display first 8, an on scroll to add next 8, and so on. Here is my codepen:

See the Pen iCDxm on CodePen.

any help?


#2

I’ve figured this out for you :smile:


#3

thank you bro, you are the MAN :smile:


#4

Hi, I have one more issue, if you can help me.
I try to implement search with input ng-model=“search.name and on ng-repeat I add filter:search. If I put ng-model in tha main.html than search work, but if I put ng-model in sidebar (example: sidepanel/immobili/afitare/appartamento/) then search doesn’t work. How can I access from sidepanel or create global filter? here is codepin:

See the Pen iCDxm

tnx


#5

You could make use of the rootscope, this makes a global model which you could call in your HTML by doing: $root.modelName

In your controller, you could inject the $rootScope like you would with the $scope object, which would give access to your rootScope in controller methods, similair for directives and providers etc.

I’ve defined an emtpy search object in your .run method, so it is always instantiated. Worked like a charm in my testing :slight_smile:

Result: