feat(common): add @angular/common/upgrade package for $location-related APIs (#30055)
AngularJS's `$location` service doesn't have a direct counterpart in Angular. This is largely because the `Location` service in Angular was pulled out of the `Router`, but was not purpose-built to stand on its own. This commit adds a new `@angular/common/upgrade` package with the beginnings of a new `LocationUpgradeService`. This service will more closely match the API of AngularJS and provide a way to replace the `$location` service from AngularJS. PR Close #30055
This commit is contained in:
10
packages/common/upgrade/src/index.ts
Normal file
10
packages/common/upgrade/src/index.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
export * from './location';
|
||||
export * from './location_module';
|
18
packages/common/upgrade/src/location.ts
Normal file
18
packages/common/upgrade/src/location.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @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 {Injectable} from '@angular/core';
|
||||
|
||||
/**
|
||||
* A Location service that provides properties and methods to match AngularJS's `$location`
|
||||
* service. It is recommended that this LocationUpgradeService be used in place of
|
||||
* `$location` in any hybrid Angular/AngularJS applications.
|
||||
*/
|
||||
@Injectable()
|
||||
export class LocationUpgradeService {
|
||||
}
|
17
packages/common/upgrade/src/location_module.ts
Normal file
17
packages/common/upgrade/src/location_module.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @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 {NgModule} from '@angular/core';
|
||||
import {LocationUpgradeService} from './location';
|
||||
|
||||
/**
|
||||
* Module used for configuring Angular's LocationUpgradeService.
|
||||
*/
|
||||
@NgModule({providers: [LocationUpgradeService]})
|
||||
export class LocationUpgradeModule {
|
||||
}
|
Reference in New Issue
Block a user