From 4c216b9bfae9f721c38db118008b1b7bfe0550c5 Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 15 Dec 2023 14:42:30 +0800 Subject: [PATCH] docs: add `withViewTransitions` --- src/app/app.config.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/app.config.ts b/src/app/app.config.ts index f230a1cce..d2831b1ba 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -2,7 +2,7 @@ import { provideHttpClient, withFetch, withInterceptors } from '@angular/common/ import ngLang from '@angular/common/locales/zh'; import { APP_ID, ApplicationConfig, ErrorHandler, importProvidersFrom } from '@angular/core'; import { provideAnimations } from '@angular/platform-browser/animations'; -import { provideRouter, withComponentInputBinding } from '@angular/router'; +import { provideRouter, withComponentInputBinding, withViewTransitions, withInMemoryScrolling } from '@angular/router'; import { ServiceWorkerModule } from '@angular/service-worker'; import { provideNuMonacoEditorConfig } from '@ng-util/monaco-editor'; @@ -92,7 +92,12 @@ export const appConfig: ApplicationConfig = { { provide: APP_ID, useValue: 'ngAlainDoc' }, provideHttpClient(withFetch(), withInterceptors([mockInterceptor])), provideAnimations(), - provideRouter(routes, withComponentInputBinding()), + provideRouter( + routes, + withComponentInputBinding(), + withViewTransitions(), + withInMemoryScrolling({ scrollPositionRestoration: 'top' }) + ), // provideClientHydration(), // 暂时不开启水合,除了编译时间长,还有就是对DOM要求比较高 provideAlain({ config: alainConfig, defaultLang, i18nClass: I18NService }), provideNzConfig(ngZorroConfig),