Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ngx-lottie
Advanced tools
ngx-lottie
provides more opportunities to work with API exposed by Lottielottie
library is loaded on demand<ng-lottie
width="600"
height="500"
containerClass="moving-box"
[options]="options"
(animationCreated)="animationCreated($event)"
(configReady)="configReady()"
(dataReady)="dataReady()"
(domLoaded)="domLoaded()"
(enterFrame)="enterFrame($event)"
(segmentStart)="segmentStart($event)"
(complete)="complete($event)"
(loopComplete)="loopComplete($event)"
(destroy)="destroy($event)"
></ng-lottie>
To install ngx-lottie
run the following command:
npm i ngx-lottie
# or if you're using yarn
yarn add ngx-lottie
First, import the LottieModule
to any of your modules:
import { NgModule } from '@angular/core';
import { LottieModule } from 'ngx-lottie';
@NgModule({
imports: [
LottieModule
]
})
export class AppModule {}
Now you can simple use an ng-lottie
component and provide your custom options via the options
binding:
import { Component } from '@angular/core';
import { LottieOptions, AnimationItem } from 'ngx-lottie';
@Component({
selector: 'app-root',
template: `
<ng-lottie
[options]="options"
(animationCreated)="animationCreated($event)"
></ng-lottie>
`
})
export class AppComponent {
public options: LottieOptions = {
path: '/assets/animation.json'
};
public animationCreated(animationItem: AnimationItem): void {
console.log(animationItem);
}
}
Also it's possible to use a lottie
directive if you'd like to provide your own custom container and play with it:
import { Component } from '@angular/core';
import { LottieOptions, AnimationItem } from 'ngx-lottie';
@Component({
selector: 'app-root',
template: `
<main
lottie
[options]="options"
(animationCreated)="animationCreated($event)"
></main>
`
})
export class AppComponent {
public options: LottieOptions = {
path: '/assets/animation.json'
};
public animationCreated(animationItem: AnimationItem): void {
console.log(animationItem);
}
}
@Input() | Type | Required | Default | Description |
---|---|---|---|---|
options | LottieOptions | required | { renderer: 'svg', loop: true, autoplay: true } | Configuration that's used by AnimationItem |
width | string | optional | null | Custom container width |
height | string | optional | null | Custom container height |
styles | LottieCSSStyleDeclaration | optional | null | Custom container styles |
containerClass | LottieContainerClass | optional | null | Custom class applied to the container |
@Output() | Type | Required | Description |
---|---|---|---|
animationCreated | AnimationItem | optional | Dispatched after the lottie successfully creates animation |
configReady | void | optional | Dispatched after the needed renderer is configured |
dataReady | void | optional | Dispatched when all parts of the animation have been loaded |
dataFailed | void | optional | Dispatched if the XMLHttpRequest , that tried to load animation data using provided path , has errored |
domLoaded | void | optional | Dispatched when elements have been added to the DOM |
enterFrame | BMEnterFrameEvent | optional | Dispatched after entering the new frame |
segmentStart | BMSegmentStartEvent | optional | Dispatched when the new segment is adjusted |
loopComplete | BMCompleteLoopEvent | optional | Dispatched after completing frame loop |
complete | BMCompleteEvent | optional | Dispatched after completing the last frame |
loadedImages | void | optional | Dispatched after all assets are preloaded |
destroy | BMDestroyEvent | optional | Dispatched in the ngOnDestroy hook of the service that manages lottie 's events, it's useful for releasing resources |
The ng-lottie
component is marked with OnPush
change detection strategy. This means it will not be checked in any phase of the change detection mechanism until you change the reference to some binding. For example if you use an svg
renderer and there are a lot DOM elements projected - you would like to avoid checking this component, as it's not necessary.
Also, events, dispatched by AnimationItem
, are listened outside Angular's zone, thus you shouldn't worry that every dispatch will be intercepted by Angular's zone.
FAQs
<table> <thead> <tr> <th>ngx-lottie</th> <th>Angular</th> </tr> </thead> <tbody> <tr> <td> 7.x </td> <td> >= 8 < 13 </td> </tr> <tr> <td> 8.x </td> <td> 13 </td> </tr> <tr> <td> 9.x </td> <td> 14 </td> </tr> <tr> <td> 10.x </td> <td> 15 </td> </tr> <tr> <
The npm package ngx-lottie receives a total of 70,776 weekly downloads. As such, ngx-lottie popularity was classified as popular.
We found that ngx-lottie demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.