Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trademe/ng-defer-load

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trademe/ng-defer-load

Angular directive to load elements lazily

  • 1.1.0-alpha.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
decreased by-0.78%
Maintainers
6
Weekly downloads
 
Created
Source

ng-defer-load

ng-defer-load is an Angular directive to load elements lazily.

It uses Intersection Observer API to check if an element is in viewport and falls back to scroll detection mechanism for unsupported browsers.

Installation

Using npm:

$ npm i @trademe/ng-defer-load

Usage

  1. Import DeferLoadModule into the module corresponding to your component

  2. Use the directive with the element you wish to lazy load

  <div
    (deferLoad)="showMyElement=true">
    <my-element
       *ngIf=showMyElement>
      ...
    </my-element>
</div>

Note: You might want to have a loading state for your element with approximately same height as the element.

Demo

Demo of ng-defer-load in use is available here.

License

Released under the MIT license.

Keywords

FAQs

Package last updated on 21 Jun 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc