Skip to content

Commit bf94932

Browse files
brandonrobertsjasonaden
authored andcommitted
docs: add link to location upgrade config (angular#30331)
PR Close angular#30331
1 parent 6cb3b50 commit bf94932

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

aio/content/guide/upgrade.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,9 @@ After this, the service is injectable anywhere in AngularJS code:
840840

841841
## Using the Unified Angular Location Service
842842

843-
AngularJS and Angular both have separate routers for configuration, handling navigation, encoding and decoding URLs, redirects, and interacting with browser APIs. When migrating from AngularJS to Angular, you have the option of running both routers to handle navigating in different parts of your application. As your migrating from AngularJS, you want to take advantage of new APIs, and move as much of this functionality to Angular.
843+
In AngularJS, the [$location service](https://docs.angularjs.org/api/ng/service/$location) handles all routing configuration and navigation, encoding and decoding of URLS, redirects, and interactions with browser APIs. Angular uses its own underlying `Location` service for all of these tasks.
844844

845-
To aid in your migration from AngularJS to Angular, a unified location service is provided to shift the routing responsibility previously handled by the `$location` provider in AngularJS to Angular.
845+
When you migrate from AngularJS to Angular you will want to move as much responsibility as possible to Angular, so that you can take advantage of new APIs. To help with the transition, Angular provides the `LocationUpgradeModule`. This module enables a _unified_ location service that shifts responsibilities from the AngularJS `$location` service to the Angular `Location` service.
846846

847847
To use the `LocationUpgradeModule`, import the symbol from `@angular/common/upgrade` and add it to your `AppModule` imports using the static `LocationUpgradeModule.config()` method.
848848

@@ -859,7 +859,7 @@ import { LocationUpgradeModule } from '@angular/common/upgrade';
859859
export class AppModule {}
860860
```
861861

862-
The `LocationUpgradeModule.config()` method accepts a configuration object that allows you configure the `LocationStrategy` with the `useHash` property, and the URL prefix with `hashPrefix` property.
862+
The `LocationUpgradeModule.config()` method accepts a configuration object that allows you to configure options including the `LocationStrategy` with the `useHash` property, and the URL prefix with the `hashPrefix` property.
863863

864864
The `useHash` property defaults to `false`, and the `hashPrefix` defaults to an empty `string`. Pass the configuration object to override the defaults.
865865

@@ -870,7 +870,13 @@ LocationUpgradeModule.config({
870870
})
871871
```
872872

873-
This registers the drop-in replacement for the `$location` provider in AngularJS. Once registered, all navigation, routing broadcast messages, and any necessary digest cycles in AngularJS triggered during navigation are handled by Angular. This gives you a single way to navigate within both sides of your hybrid application consistently.
873+
<div class="alert is-important">
874+
875+
**Note:** See the `LocationUpgradeConfig` for more configuration options available to the `LocationUpgradeModule.config()` method.
876+
877+
</div>
878+
879+
This registers a drop-in replacement for the `$location` provider in AngularJS. Once registered, all navigation, routing broadcast messages, and any necessary digest cycles in AngularJS triggered during navigation are handled by Angular. This gives you a single way to navigate within both sides of your hybrid application consistently.
874880

875881
For usage of the `$location` service as a provider in AngularJS, you need to downgrade the `$locationShim` using a factory provider.
876882

0 commit comments

Comments
 (0)