Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function transferAnimationData(
state: TransferState,
animation: AnimationFilename,
animationData: AnimationData
): void {
animation = transformAnimationFilenameToKey(animation);
const key = makeStateKey(animation);
state.set(key, JSON.parse(animationData));
}
import { BrowserModule, BrowserTransferStateModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { LottieModule } from 'ngx-lottie';
import { AppComponent } from './app.component';
export function playerFactory() {
return import('lottie-web');
}
@NgModule({
imports: [
BrowserModule.withServerTransition({ appId: 'ngx-lottie-universal' }),
BrowserTransferStateModule,
HttpClientModule,
LottieModule.forRoot({
player: playerFactory,
useCache: true
})
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
import { NgModule } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
import { LottieServerModule } from 'ngx-lottie/server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [
AppModule,
ServerModule,
ServerTransferStateModule,
LottieServerModule.forRoot({
preloadAnimations: {
folder: 'dist-integration/assets/animations',
animations: ['data.json']
}
})
],
bootstrap: [AppComponent]
})
export class AppServerModule {}