{ "id": "api/router/UrlHandlingStrategy", "title": "UrlHandlingStrategy", "contents": "\n\n
\n
\n
\n \n API > @angular/router\n
\n \n
\n \n
\n

UrlHandlingStrategylink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

Provides a way to migrate AngularJS applications to Angular.

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

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n \n
\n
\n

\n shouldProcessUrl()\n \n link

\n \n
\n
\n

Tells the router if this URL should be processed.

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

boolean

\n\n \n\n\n \n\n \n
\n
\n

When it returns true, the router will execute the regular navigation.\nWhen it returns false, the router will set the router state to an empty state.\nAs a result, all the active components will be destroyed.

\n\n
\n\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n extract()\n \n link

\n \n
\n
\n

Extracts the part of the URL that should be handled by the router.\nThe rest of the URL will remain untouched.

\n\n
\n
\n \n\n abstract extract(url: UrlTree): UrlTree\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n
\n \n url\n UrlTree\n \n \n
\n\n \n
Returns
\n

UrlTree

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n merge()\n \n link

\n \n
\n
\n

Merges the URL fragment with the rest of the URL.

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

UrlTree

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n\n\n \n\n\n
\n
\n\n\n" }