forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(router): add support for ng1/ng2 migration (angular#12160)
- Loading branch information
1 parent
a68a8ad
commit 315042a
Showing
8 changed files
with
321 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @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 {UrlTree} from './url_tree'; | ||
|
||
/** | ||
* @whatItDoes Provides a way to migrate Angular 1 applications to Angular 2. | ||
* | ||
* @experimental | ||
*/ | ||
export abstract class UrlHandlingStrategy { | ||
/** | ||
* Tells the router if this URL should be processed. | ||
* | ||
* When it returns true, the router will execute the regular navigation. | ||
* When it returns false, the router will set the router state to an empty state. | ||
* As a result, all the active components will be destroyed. | ||
* | ||
*/ | ||
abstract shouldProcessUrl(url: UrlTree): boolean; | ||
|
||
/** | ||
* Extracts the part of the URL that should be handled by the router. | ||
* The rest of the URL will remain untouched. | ||
*/ | ||
abstract extract(url: UrlTree): UrlTree; | ||
|
||
/** | ||
* Merges the URL fragment with the rest of the URL. | ||
*/ | ||
abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree; | ||
} | ||
|
||
/** | ||
* @experimental | ||
*/ | ||
export class DefaultUrlHandlingStrategy implements UrlHandlingStrategy { | ||
shouldProcessUrl(url: UrlTree): boolean { return true; } | ||
extract(url: UrlTree): UrlTree { return url; } | ||
merge(newUrlPart: UrlTree, wholeUrl: UrlTree): UrlTree { return newUrlPart; } | ||
} |
Oops, something went wrong.