/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v21.2.11
src/dev-app/main.ts
67 строк
2 KB
Kristiyan Kostadinov
build: remove provideHttpClient (#32109)
20 окт 2025, 20:28
Не верифицирован
20 окт 2025, 20:28
daaa69c
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ // Load `$localize` for examples using it. import '@angular/localize/init'; import { provideZonelessChangeDetection, // tslint:disable-next-line:no-zone-dependencies -- Allow manual testing of dev-app with zones provideZoneChangeDetection, } from '@angular/core'; import {bootstrapApplication} from '@angular/platform-browser'; import {provideRouter} from '@angular/router'; import {Directionality} from '@angular/cdk/bidi'; import {FullscreenOverlayContainer, OverlayContainer} from '@angular/cdk/overlay'; import { MAT_RIPPLE_GLOBAL_OPTIONS, MATERIAL_ANIMATIONS, provideNativeDateAdapter, AnimationsConfig, } from '@angular/material/core'; import {DevApp} from './dev-app'; import {DevAppDirectionality} from './dev-app/dev-app-directionality'; import {getAppState} from './dev-app/dev-app-state'; import {DevAppRippleOptions} from './dev-app/ripple-options'; import {DEV_APP_ROUTES} from './routes'; // We need to insert this stylesheet manually since it depends on the value from the app state. // It uses a different file, instead of toggling a class, to avoid other styles from bleeding in. const cachedAppState = getAppState(); const theme = document.createElement('link'); theme.href = cachedAppState.m3Enabled ? 'theme-m3.css' : 'theme.css'; theme.id = 'theme-styles'; theme.rel = 'stylesheet'; // Bootstrap the app after the theme has loaded so we can properly test the // theme loaded checks. This also avoids a flicker if it takes too long to load. theme.addEventListener('load', bootstrap, {once: true}); document.head.appendChild(theme); function bootstrap(): void { bootstrapApplication(DevApp, { providers: [ provideRouter(DEV_APP_ROUTES), provideNativeDateAdapter(), { provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: !cachedAppState.animations, } as AnimationsConfig, }, {provide: OverlayContainer, useClass: FullscreenOverlayContainer}, {provide: MAT_RIPPLE_GLOBAL_OPTIONS, useExisting: DevAppRippleOptions}, {provide: Directionality, useClass: DevAppDirectionality}, cachedAppState.zoneless ? provideZonelessChangeDetection() : provideZoneChangeDetection({eventCoalescing: true, runCoalescing: true}), ], }); }