Hi guys I'm trying to make blazy work with AngularJs, I followed their documentation but it still does not work.
Here's the snippets of my code:
Script:
(function() {
var bLazy = new Blazy({
breakpoints: [
{
width: 420, // max-width
src: 'data-blazy-small'
},
{
width: 1200, // max-width
src: 'data-blazy-large'
},
]
, success: function(element){
setTimeout(function(){
var parent = element.parentNode;
parent.className = parent.className.replace(/\bloading\b/,'');
}, 200);
}
});
})();
HTML:
<img ng-repeat = "image in main.imageLists"
class="b-lazy"
data-blazy-large="{{image.largeImg}}"
data-blazy-small="{{image.smallImg}}"
alt="Responsive Images" />
Controller:
this.imageLists = [{ smallImg:'assets/images/bear-small1.jpg',
largeImg:'assets/images/big-bear2.jpg',
},
{ smallImg:'assets/images/bear-small2.jpg',
largeImg:'assets/images/big-bear1.jpg',
}];
Object is to properly parse using ng-src but no lazyloading happens. Can you enlighten me as to what am I'm doing wrong here?