![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@silmar/ng-lazy-images
Advanced tools
Library that will make your images or content lazy!
Inspired by ngx-lazy-load-images and How to use Lazy Loading to Slash Page Load Time
Uses IntersectionObserver
and MutationObserver
, both are not available pre IE 11 - in this case the lib will fall-back to immediate image loading.
You can use polyfills for both:
npm i @silmar/ng-lazy-images
// or
yarn add @silmar/ng-lazy-images
import { NgModule } from '@angular/core';
import { NgLazyImagesModule } from '@silmar/ng-lazy-images';
@NgModule({
imports: [
NgLazyImagesModule
]
})
export class AppComponent {}
import { NgModule } from '@angular/core';
import { NgLazyImagesModule } from '@silmar/ng-lazy-images';
@NgModule({
imports: [
NgLazyImagesModule.forRoot({lazyClass: 'lazy-css-class'})
]
})
export class AppComponent {}
interface LazyConfig {
intersectionConfig?: IntersectionConfigInterface;
lazyClass?: string;
waitingClass?: string;
loadingClass?: string;
loadedClass?: string;
errorClass?: string;
idleLoadTimeout?: number;
}
interface IntersectionConfigInterface {
root?: any | null;
rootMargin?: string;
threshold?: number | number[];
}
<!-- Image tags -->
<div class="image-list" siLazyImages>
<img *ngFor="let imageUrl in images" [attr.data-src]="imageUrl">
</div>
<!-- Background images -->
<div class="image-list" siLazyImages>
<div *ngFor="let imageUrl in images" [attr.data-background-src]="imageUrl"></div>
</div>
<!-- Use it with NG Thumbor -->
<si-thumbor-picture siLazyImages path="expobeds.com/expo_beds_logo.png" [x2]="true" [width]="320" [height]="200"
[useDataSrc]="true"
[bySize]="{'phone':100,'(max-width: 1060px)':'300x200', 'hd':400, 'fullhd': 600}"
[set1pxOnLazy]="true"></si-thumbor-picture>
This is just a small wrapper around the IntersectionObserver. If you need to load the contents of div or something else only when/if this div gets visible in the viewport you can use this directive.
<!-- Image tags -->
<div class="some-class" siLazyContent (visible)="onDivVisible($event)">
...
</div>
FAQs
Easy lazy loading for Angular
We found that @silmar/ng-lazy-images demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.