feat: pre-render routes and restore scroll
This commit is contained in:
+3
-1
@@ -37,7 +37,9 @@
|
|||||||
],
|
],
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
"server": "src/main.server.ts",
|
"server": "src/main.server.ts",
|
||||||
"prerender": true,
|
"prerender": {
|
||||||
|
"routes": ["/", "/imprint"]
|
||||||
|
},
|
||||||
"ssr": {
|
"ssr": {
|
||||||
"entry": "src/server.ts"
|
"entry": "src/server.ts"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {ApplicationConfig, importProvidersFrom, provideZoneChangeDetection} from '@angular/core';
|
import {ApplicationConfig, importProvidersFrom, provideZoneChangeDetection} from '@angular/core';
|
||||||
import {provideRouter} from '@angular/router';
|
import {provideRouter, withInMemoryScrolling} from '@angular/router';
|
||||||
import {BrowserModule, provideClientHydration, withEventReplay} from '@angular/platform-browser';
|
import {BrowserModule, provideClientHydration, withEventReplay} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {routes} from './app.routes';
|
import {routes} from './app.routes';
|
||||||
@@ -8,7 +8,10 @@ import {provideAnimations} from '@angular/platform-browser/animations';
|
|||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
provideZoneChangeDetection({eventCoalescing: true}),
|
provideZoneChangeDetection({eventCoalescing: true}),
|
||||||
provideRouter(routes),
|
provideRouter(routes, withInMemoryScrolling({
|
||||||
|
anchorScrolling: 'enabled',
|
||||||
|
scrollPositionRestoration: 'top'
|
||||||
|
})),
|
||||||
provideClientHydration(withEventReplay()),
|
provideClientHydration(withEventReplay()),
|
||||||
importProvidersFrom(BrowserModule),
|
importProvidersFrom(BrowserModule),
|
||||||
provideAnimations()
|
provideAnimations()
|
||||||
|
|||||||
Reference in New Issue
Block a user