From d29f24079b5afdbe6a818cb453722ddb0b7e94b9 Mon Sep 17 00:00:00 2001 From: cipchk Date: Wed, 20 Dec 2023 14:01:28 +0800 Subject: [PATCH] feat(cli): add `withViewTransitions` --- schematics/application/files/src/app/app.config.ts | 8 ++++++-- src/app/app.config.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/schematics/application/files/src/app/app.config.ts b/schematics/application/files/src/app/app.config.ts index d786f7dac..2bc129f30 100644 --- a/schematics/application/files/src/app/app.config.ts +++ b/schematics/application/files/src/app/app.config.ts @@ -2,7 +2,7 @@ import { provideHttpClient, withInterceptors } from '@angular/common/http'; import { default as ngLang } from '@angular/common/locales/zh'; import { ApplicationConfig, EnvironmentProviders, Provider } from '@angular/core'; import { provideAnimations } from '@angular/platform-browser/animations'; -import { provideRouter, withComponentInputBinding, withInMemoryScrolling, withHashLocation, RouterFeatures } from '@angular/router'; +import { provideRouter, withComponentInputBinding, withViewTransitions, withInMemoryScrolling, withHashLocation, RouterFeatures } from '@angular/router'; import { <% if (i18n) { %>I18NService, <% } %>defaultInterceptor, provideStartup } from '@core'; import { provideCellWidgets } from '@delon/abc/cell'; import { provideSTWidgets } from '@delon/abc/st'; @@ -35,7 +35,11 @@ const alainConfig: AlainConfig = { const ngZorroConfig: NzConfig = {}; -const routerFeatures: RouterFeatures[] = [withComponentInputBinding(), withInMemoryScrolling({ scrollPositionRestoration: 'top' })]; +const routerFeatures: RouterFeatures[] = [ + withComponentInputBinding(), + withViewTransitions(), + withInMemoryScrolling({ scrollPositionRestoration: 'top' }) +]; if (environment.useHash) routerFeatures.push(withHashLocation()); const providers: Array = [ diff --git a/src/app/app.config.ts b/src/app/app.config.ts index f230a1cce..8acf593ff 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 } from '@angular/router'; import { ServiceWorkerModule } from '@angular/service-worker'; import { provideNuMonacoEditorConfig } from '@ng-util/monaco-editor'; @@ -92,7 +92,7 @@ export const appConfig: ApplicationConfig = { { provide: APP_ID, useValue: 'ngAlainDoc' }, provideHttpClient(withFetch(), withInterceptors([mockInterceptor])), provideAnimations(), - provideRouter(routes, withComponentInputBinding()), + provideRouter(routes, withViewTransitions(), withComponentInputBinding()), // provideClientHydration(), // 暂时不开启水合,除了编译时间长,还有就是对DOM要求比较高 provideAlain({ config: alainConfig, defaultLang, i18nClass: I18NService }), provideNzConfig(ngZorroConfig),