Can't bind to 'lazyLoad' since it isn't a known property of 'img'. in ionic3?

I have got above error after reload the page in ionic3 after apply lazy Loading on images ?

Steps I took:

Ran Npm:
npm install ng2-lazyload-image --save`

Imported into my component:
import { LazyLoadImageDirective } from 'ng2-lazyload-image';

In my template:
<img id=“greenId” [src]=“assets/imgs/product_defaultImg.png” class=“imageSetInCard”
[lazyLoad]=“userProduct.ImageCollection[0].url”>

In above template userProduct.ImageCollection is array of dynamic image that is get from the Fire-store but i got above error after load page.
Maybe there’s something I’m overlooking, but I can’t seem to see what it is.

If you haven’t already, you will need to import the LazyLoadImageModule in your AppModule

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LazyLoadImageModule } from 'ng-lazyload-image';
import { AppComponent } from './app.component';

@NgModule({
    declarations: [ AppComponent ],
    imports: [ BrowserModule, LazyLoadImageModule ],
    bootstrap: [ AppComponent ]
})
export class MyAppModule {}

sir i have import LazyLoadImageModule in our app.module.ts file but error is not fix again got same error?

1 Like