Skip to content

Commit

Permalink
feat(cli): add withViewTransitions (#1736)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Jan 11, 2024
1 parent e17f5e7 commit c03a797
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions schematics/application/files/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<Provider | EnvironmentProviders> = [
Expand Down
9 changes: 7 additions & 2 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, withInMemoryScrolling } from '@angular/router';
import { provideRouter, withComponentInputBinding, withInMemoryScrolling, withViewTransitions } from '@angular/router';
import { ServiceWorkerModule } from '@angular/service-worker';

import { provideNuMonacoEditorConfig } from '@ng-util/monaco-editor';
Expand Down Expand Up @@ -92,7 +92,12 @@ export const appConfig: ApplicationConfig = {
{ provide: APP_ID, useValue: 'ngAlainDoc' },
provideHttpClient(withFetch(), withInterceptors([mockInterceptor])),
provideAnimations(),
provideRouter(routes, withComponentInputBinding(), withInMemoryScrolling({ scrollPositionRestoration: 'top' })),
provideRouter(
routes,
withComponentInputBinding(),
withViewTransitions(),
withInMemoryScrolling({ scrollPositionRestoration: 'top' })
),
// provideClientHydration(), // 暂时不开启水合,除了编译时间长,还有就是对DOM要求比较高
provideAlain({ config: alainConfig, defaultLang, i18nClass: I18NService }),
provideNzConfig(ngZorroConfig),
Expand Down

0 comments on commit c03a797

Please sign in to comment.