Pentiado / angular-lazy-img

Lightweight lazy load images plugin. Only 1kb after gziping. Pure JavaScript, only Angular as dependency.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

So my scroll container is not $window. And am not able to implement it in particular controller

salilbajaj opened this issue · comments

in my app.js i wrote
app.config(['lazyImgConfigProvider', function(lazyImgConfigProvider){
setTimeout(function(){
var scrollable = document.querySelector('#int-scroll');
lazyImgConfigProvider.setOptions({
offset: 100,
errorClass: 'error',
onError: function(image){},
onSuccess: function(image){},
container: angular.element(scrollable)
});
},1000)
}]);

So I am using lazy load in listing page. But app.config runs on first load. So if I refresh the listing page(whole app on listing page),it works fine. But when i come from home page it does not work because app.config wont run again.

I want to run the code above when i reach listing controller. Please help

You need to add "lazy-img-container" attribute to container and it will work. For example check /demo/container-demo.html