填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

UrlHandlingStrategy

提供一种将 AngularJS 应用程序迁移到 Angular 的方法。

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
}
    

方法

告诉路由器是否应处理此 URL。

Tells the router if this URL should be processed.

      
      abstract shouldProcessUrl(url: UrlTree): boolean
    
参数
url UrlTree
返回值

boolean

当返回 true 时,路由器将执行常规导航。当返回 false 时,路由器会将路由器状态设置为空状态。结果,所有活动组件都将被破坏。

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.

提取应由路由器处理的 URL 部分。 URL 的其余部分将保持不变。

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
    
参数
url UrlTree
返回值

UrlTree

将 URL 片段与 URL 的其余部分合并。

Merges the URL fragment with the rest of the URL.

      
      abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree
    
参数
newUrlPart UrlTree
rawUrl UrlTree
返回值

UrlTree