UNPKG

ngx-lottie

Version:

<h1 align="center"> <img src="https://raw.githubusercontent.com/ngx-lottie/ngx-lottie/master/docs/assets/lottie.gif"> </h1>

41 lines 1.39 kB
import { Component, ChangeDetectionStrategy, Input, Inject, ElementRef, ViewChild, PLATFORM_ID, NgZone, } from '@angular/core'; import { BaseDirective } from './base.directive'; import { AnimationLoader } from './animation-loader'; export class LottieComponent extends BaseDirective { constructor(ngZone, platformId, animationLoader) { super(ngZone, platformId, animationLoader); this.width = null; this.height = null; this.container = null; } ngOnChanges(changes) { super.loadAnimation(changes, this.container.nativeElement); } } LottieComponent.decorators = [ { type: Component, args: [{ selector: 'ng-lottie', template: ` <div #container [style.width]="width || '100%'" [style.height]="height || '100%'" [ngStyle]="styles" [ngClass]="containerClass" ></div> `, changeDetection: ChangeDetectionStrategy.OnPush },] } ]; /** @nocollapse */ LottieComponent.ctorParameters = () => [ { type: NgZone }, { type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }, { type: AnimationLoader } ]; LottieComponent.propDecorators = { width: [{ type: Input }], height: [{ type: Input }], container: [{ type: ViewChild, args: ['container', { static: true },] }] }; //# sourceMappingURL=lottie.component.js.map