All files / tools/ReFlex.TrackingServer/ClientApp/src/app app.config.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 401x               1x                   1x 1x       1x     1x   1x                      
import {
  ApplicationConfig,
  ErrorHandler,
  importProvidersFrom,
  provideBrowserGlobalErrorListeners,
  provideZonelessChangeDetection
} from '@angular/core';
import { provideRouter } from '@angular/router';
import { BASE_URL } from 'src/shared/tokens/base-url.token';
 
import { PlatformLocation } from '@angular/common';
import {
  provideHttpClient,
  withInterceptorsFromDi,
  withXhr
} from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { CustomErrorHandler } from 'src/shared/util/custom-error-handler';
import { routes } from './app.routes';
 
export function getBaseUrl(platformLocation: PlatformLocation): string {
  // return document.getElementsByTagName('base')[0].href;
  return platformLocation.getBaseHrefFromDOM();
}
 
const providers = [{ provide: BASE_URL, useFactory: getBaseUrl, deps: [PlatformLocation] }];
 
export const appConfig: ApplicationConfig = {
  providers: [
    provideZonelessChangeDetection(),
    providers,
    importProvidersFrom(BrowserModule, FormsModule),
    { provide: ErrorHandler, useClass: CustomErrorHandler },
    provideHttpClient(withXhr(), withInterceptorsFromDi()),
    provideBrowserGlobalErrorListeners(),
    provideRouter(routes)
  ]
};