angular lazy load image code example
Example 1: angular lazy loading images
npm install ng-lazyload-image --save
Example 2: ng-lazyload-image
<img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="'https://hd.unsplash.com/photo-1431400445088-1750c997c6b5'" />
Example 3: angular lazy loading images
mport { Component } from '@angular/core';@Component({ selector: 'image', template: ` <img [defaultImage]="defaultImage" [lazyLoad]="image"> `})class ImageComponent { defaultImage = 'https://www.placecage.com/1000/1000'; image = 'https://images.unsplash.com/photo-1443890923422-7819ed4101c0?fm=jpg';}