Last active
December 25, 2015 14:39
-
-
Save nielk/6992648 to your computer and use it in GitHub Desktop.
angularjs ng-repeat infinite scroll with jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app="app" ng-controller="listCtrl" id="listr" ng-init="count=10"> | |
<div ng-repeat="chose in choses | orderBy:'date':true | limitTo:count" class="choses"> | |
<section class="inner"> | |
<div class="row container-chose"> | |
<div class="col-sm-2 col-md-2 col-lg-2" ng-class-odd="'odd'" ng-class-even="'even'"> | |
<img src="./uploads/{{chose.image}}" class="img-circle chose" /> | |
</div> | |
<div class="col-sm-5 col-md-5 col-lg-5" ng-class-odd="'even'" ng-class-even="'odd'"> | |
<h2>{{chose.title}} par {{chose.author}}</h2> | |
<p>{{chose.content}}</p> | |
</div> | |
</div> | |
</section> | |
</div> | |
</div> | |
<script> | |
$(document).ready(function() { | |
$(window).scroll(function() { | |
if ($(window).scrollTop() == $(document).height() - $(window).height()) { | |
var scope = angular.element($("#listr")).scope(); | |
scope.$apply(function(){ | |
scope.count = scope.count + 10; | |
}); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment