Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

UrlHandlingStrategy

Provides a way to migrate AngularJS applications to Angular.

      
      abstract class UrlHandlingStrategy {
abstract shouldProcessUrl(url: UrlTree): boolean
abstract extract(url: UrlTree): UrlTree
abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree }

Provided in

  • 'root'

Methods

Tells the router if this URL should be processed.

      
      abstract shouldProcessUrl(url: UrlTree): boolean
    
Parameters
url UrlTree
Returns

boolean

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.

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
    
Parameters
url UrlTree
Returns

UrlTree

Merges the URL fragment with the rest of the URL.

      
      abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree
    
Parameters
newUrlPart UrlTree
rawUrl UrlTree
Returns

UrlTree