refactor(common): rename LocationUpgradeService and remove angular/upgrade dependency (#30055)
PR Close #30055
This commit is contained in:
@ -26,7 +26,7 @@ const DEFAULT_PORTS: {[key: string]: number} = {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class LocationUpgradeService {
|
||||
export class $locationShim {
|
||||
private initalizing = true;
|
||||
private updateBrowser = false;
|
||||
private $$absUrl: string = '';
|
||||
@ -664,14 +664,14 @@ export class LocationUpgradeService {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class LocationUpgradeProvider {
|
||||
export class $locationShimProvider {
|
||||
constructor(
|
||||
private ngUpgrade: UpgradeModule, private location: Location,
|
||||
private platformLocation: PlatformLocation, private urlCodec: UrlCodec,
|
||||
private locationStrategy: LocationStrategy) {}
|
||||
|
||||
$get() {
|
||||
return new LocationUpgradeService(
|
||||
return new $locationShim(
|
||||
this.ngUpgrade.$injector, this.location, this.platformLocation, this.urlCodec,
|
||||
this.locationStrategy);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. 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.io/license
|
||||
*/
|
||||
|
||||
import {downgradeInjectable} from '@angular/upgrade/static';
|
||||
import {LocationUpgradeProvider} from './$location';
|
||||
|
||||
/**
|
||||
* Name of AngularJS module under which $location upgrade services are exported.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const LOCATION_UPGRADE_MODULE = 'LOCATION_UPGRADE_MODULE';
|
||||
|
||||
/**
|
||||
* Downgraded $location provider. API should match AngularJS $location and should be a drop-in
|
||||
* replacement.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const $locationProvider = downgradeInjectable(LocationUpgradeProvider);
|
@ -7,6 +7,5 @@
|
||||
*/
|
||||
|
||||
export * from './location_upgrade_module';
|
||||
export * from './angular_js_module';
|
||||
export * from './$location';
|
||||
export * from './$location_shim';
|
||||
export * from './params';
|
@ -10,9 +10,10 @@ import {APP_BASE_HREF, CommonModule, HashLocationStrategy, Location, LocationStr
|
||||
import {Inject, InjectionToken, ModuleWithProviders, NgModule, Optional} from '@angular/core';
|
||||
import {UpgradeModule} from '@angular/upgrade/static';
|
||||
|
||||
import {LocationUpgradeProvider, LocationUpgradeService} from './$location';
|
||||
import {$locationShim, $locationShimProvider} from './$location_shim';
|
||||
import {AngularJSUrlCodec, UrlCodec} from './params';
|
||||
|
||||
|
||||
/**
|
||||
* Configuration options for LocationUpgrade.
|
||||
*
|
||||
@ -49,7 +50,7 @@ export class LocationUpgradeModule {
|
||||
providers: [
|
||||
Location,
|
||||
{
|
||||
provide: LocationUpgradeService,
|
||||
provide: $locationShim,
|
||||
useFactory: provide$location,
|
||||
deps: [UpgradeModule, Location, PlatformLocation, UrlCodec, LocationStrategy]
|
||||
},
|
||||
@ -101,8 +102,8 @@ export function provideLocationStrategy(
|
||||
export function provide$location(
|
||||
ngUpgrade: UpgradeModule, location: Location, platformLocation: PlatformLocation,
|
||||
urlCodec: UrlCodec, locationStrategy: LocationStrategy) {
|
||||
const $locationProvider = new LocationUpgradeProvider(
|
||||
ngUpgrade, location, platformLocation, urlCodec, locationStrategy);
|
||||
const $locationProvider =
|
||||
new $locationShimProvider(ngUpgrade, location, platformLocation, urlCodec, locationStrategy);
|
||||
|
||||
return $locationProvider.$get();
|
||||
}
|
Reference in New Issue
Block a user