1

I want to build something like qz.com

The url changes(without page refresh) when you scroll down and the data gets appended to the last post. Trying to build it over angular-express-seed.

Any pointers or tutorials will help.

EDIT: Found a fiddle here http://jsfiddle.net/fotuzlab/nES2q/ (forked from original)

elm.bind('scroll', function() {
            if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
                scope.$apply(attr.whenScrolled);
            }
        });

Seems it can do the job but now elm.bind is not working for some reason. Any other method to so this?

fotuzlab
  • 1,436
  • 1
  • 15
  • 19
  • Which version of angularjs are you using? – interlude Sep 11 '13 at 12:04
  • Possible duplicate of: http://stackoverflow.com/q/12115259/149060 – Pauli Price Sep 11 '13 at 17:06
  • Its AngularJS v1.0.7. – fotuzlab Sep 23 '13 at 05:31
  • @marfarma: I went through that link but thats not what I am looking for. Take it in this way: A page that has infinite scroll of posts and with every post the url changes. I found this http://jsfiddle.net/fotuzlab/nES2q/ but elm.bind is not working for some reason. working on it. – fotuzlab Sep 23 '13 at 05:42
  • Now upgraded to AngularJS v1.0.8 – fotuzlab Oct 03 '13 at 05:16
  • I answered in a similar question. Take a look this answer. http://stackoverflow.com/questions/13358020/how-can-i-make-wordpress-infinite-scrolling-change-the-url/31243320#31243320 – wataru Jul 06 '15 at 19:19

1 Answers1

0

Answering own question in case it helps someone.

Instead of writing a complete custom directive to achieve the purpose, integrated a controller with inview directive.

  1. Added div in partial which calls a controller loadnext().

    <\div in-view="loadNext($inview);" </div>

  2. Controller calculates the next article and pushes it in view.

    $scope.posts.push(data)

This can be seen working at http://sarus.srijanlabs.com

This project has been open sourced under the name Sarus. Complete code can be checked there https://github.com/srijanlabs/sarus

All thanks to my collegue @whizcreed to get this working.

fotuzlab
  • 1,436
  • 1
  • 15
  • 19