From 5965f4e929eb5a9186b4464b0144899c11435c8a Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Fri, 4 Sep 2020 14:32:13 +0200 Subject: [PATCH] remove circular dependency --- .../core/services/browser-hard-redirect.service.ts | 9 +++++++-- src/modules/app/browser-app.module.ts | 13 +++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/core/services/browser-hard-redirect.service.ts b/src/app/core/services/browser-hard-redirect.service.ts index 725848212f..0d14b6b834 100644 --- a/src/app/core/services/browser-hard-redirect.service.ts +++ b/src/app/core/services/browser-hard-redirect.service.ts @@ -1,7 +1,12 @@ -import { Inject, Injectable } from '@angular/core'; -import { LocationToken } from '../../../modules/app/browser-app.module'; +import { Inject, Injectable, InjectionToken } from '@angular/core'; import { HardRedirectService } from './hard-redirect.service'; +export const LocationToken = new InjectionToken('Location'); + +export function locationProvider(): Location { + return window.location; +} + /** * Service for performing hard redirects within the browser app module */ diff --git a/src/modules/app/browser-app.module.ts b/src/modules/app/browser-app.module.ts index 7306e7db6c..08ce2737c6 100644 --- a/src/modules/app/browser-app.module.ts +++ b/src/modules/app/browser-app.module.ts @@ -1,5 +1,5 @@ import { HttpClient, HttpClientModule } from '@angular/common/http'; -import { InjectionToken, NgModule } from '@angular/core'; +import { NgModule } from '@angular/core'; import { BrowserModule, makeStateKey, TransferState } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterModule } from '@angular/router'; @@ -22,7 +22,10 @@ import { Angulartics2RouterlessModule } from 'angulartics2/routerlessmodule'; import { SubmissionService } from '../../app/submission/submission.service'; import { StatisticsModule } from '../../app/statistics/statistics.module'; import { HardRedirectService } from '../../app/core/services/hard-redirect.service'; -import { BrowserHardRedirectService } from '../../app/core/services/browser-hard-redirect.service'; +import { + BrowserHardRedirectService, + LocationToken, locationProvider +} from '../../app/core/services/browser-hard-redirect.service'; export const REQ_KEY = makeStateKey('req'); @@ -34,12 +37,6 @@ export function getRequest(transferState: TransferState): any { return transferState.get(REQ_KEY, {}); } -export const LocationToken = new InjectionToken('Location'); - -export function locationProvider(): Location { - return window.location; -} - @NgModule({ bootstrap: [AppComponent], imports: [