Replaying events with preboot
In the Integrating Angular Universal section, we saw that an SSR application does not respond to user events other than navigations with the routerLink
directive until it is entirely bootstrapped. We will now learn how to queue and replay those events when the application has been fully loaded using the preboot library. Let's see how to use it:
- Execute the following npm command to install the library:
npm install preboot
- Open the
app.module.ts
file and importPrebootModule
from thepreboot
npm package:
import { PrebootModule } from 'preboot';
- Add the
PrebootModule
class to theimports
array of the@NgModule
decorator:
@NgModule({
declarations: [
AppComponent,
PersonalInfoComponent,
PanelComponent,
RepositoriesComponent,
OrganizationsComponent
],
imports: [
BrowserModule.withServerTransition({ appId:
'serverApp' }),
HttpClientModule,
TransferHttpCacheModule,
PrebootModule.withConfig...