angularjs - Progressive loading in ng-repeat for images, angular js -
i hope can help, been on internet looking solutions , cannot find..
do of know how implement progressive loaded of content scroll down page? otherwise 1000 images load @ same times.
thanks much.
use infinite scrolling directive. nginfinitescroll
html
<div ng-app='myapp' ng-controller='democontroller'> <div infinite-scroll='loadmore()' infinite-scroll-distance='2'> <img ng-repeat='image in images' ng-src='http://placehold.it/225x250&text={{image}}'> </div> </div>
js
var myapp = angular.module('myapp', ['infinite-scroll']); myapp.controller('democontroller', function($scope) { $scope.images = [1, 2, 3, 4, 5, 6, 7, 8]; $scope.loadmore = function() { var last = $scope.images[$scope.images.length - 1]; for(var = 1; <= 8; i++) { $scope.images.push(last + i); } }; });
Comments
Post a Comment