@angular/router
Implements the Angular Router service , which enables navigation from one view to the next as users perform application tasks.
Defines the Route
object that maps a URL path to a component, and the RouterOutlet
directive that you use to place a routed view in a template, as well as a complete API for configuring, querying, and controlling the router state.
Import RouterModule
to use the Router service in your app. For more usage information, see the Routing and Navigation guide.
入口点
主要
@angular/router | Implements the Angular Router service , which enables navigation from one view to the next as users perform application tasks. |
次要
@angular/router/testing | |
@angular/router/upgrade |
主入口点的导出
模块
RouterModule | 添加路由器指令和服务提供商。 Adds router directives and providers. |
类
ActivationEnd | Represents the start of end of the Resolve phase of routing. See note on |
ActivationStart | Represents the start of end of the Resolve phase of routing. See note on |
ChildActivationEnd | Represents the start of end of the Resolve phase of routing. See note on |
ChildActivationStart | Represents the start of end of the Resolve phase of routing. See note on |
ChildrenOutletContexts | Store contextual information about the children (= nested) |
DefaultUrlSerializer | A default implementation of the |
GuardsCheckEnd | 表示路由的守卫( Represents the end of the Guard phase of routing. |
GuardsCheckStart | 表示路由的守卫( Represents the start of the Guard phase of routing. |
NavigationCancel | 表示当导航被取消时触发的事件。 Represents an event triggered when a navigation is canceled. |
NavigationEnd | 表示当导航成功结束时触发的事件。 Represents an event triggered when a navigation ends successfully. |
NavigationError | 表示当导航出错时触发的事件。 Represents an event triggered when a navigation fails due to an unexpected error. |
NavigationStart | 代表导航开始时触发的事件。 Represents an event triggered when a navigation starts. |
NoPreloading | Provides a preloading strategy that does not preload any modules. |
OutletContext | Store contextual information about a |
PreloadAllModules | Provides a preloading strategy that preloads all modules as quickly as possible. |
PreloadingStrategy | Provides a preloading strategy. |
ResolveEnd | 表示路由解析( Represents the end of the Resolve phase of routing. See note on |
ResolveStart | 表示路由解析( Represents the start of the Resolve phase of routing. The timing of this event may change, thus it's experimental. In the current iteration it will run in the "resolve" phase whether there's things to resolve or not. In the future this behavior may change to only run when there are things to be resolved. |
RouteConfigLoadEnd | 表示当某个路由被惰性加载时触发的事件。 Represents an event triggered when a route has been lazy loaded. |
RouteConfigLoadStart | 表示在惰性加载某个路由配置前触发的事件。 Represents an event triggered before lazy loading a route config. |
RouteReuseStrategy | Provides a way to customize when activated routes get reused. |
Router | 提供导航和操纵 URL 的能力。 Provides the navigation and url manipulation capabilities. |
RouterEvent | 路由器相关事件的(而不是关于特定路由的)基类。对于任何指定的导航, Base for events the Router goes through, as opposed to events tied to a specific Route. |
RouterPreloader | The preloader optimistically loads all router configurations to make navigations into lazily-loaded sections of the application faster. |
RoutesRecognized | 表示当路由被识别出来时触发的事件。 Represents an event triggered when routes are recognized. |
Scroll | 表示一个滚动事件。 Represents a scrolling event. |
UrlHandlingStrategy | Provides a way to migrate AngularJS applications to Angular. |
UrlSegment | Represents a single URL segment. |
UrlSegmentGroup | Represents the parsed URL segment group. |
UrlSerializer | Serializes and deserializes a URL string into a URL tree. |
函数
convertToParamMap | |
provideRoutes | 注册路由。 Registers routes. |
结构
ActivatedRoute | 包含与当前组件相关的路由信息。 Contains the information about a route associated with a component loaded in an outlet. An |
ActivatedRouteSnapshot | 包含与当前组件相关的路由的当前瞬间信息。 Contains the information about a route associated with a component loaded in an outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to traverse the router state tree. |
CanActivate | 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由能否激活。 如果所有守卫都返回 Interface that a class can implement to be a guard deciding if a route can be activated. If all guards return |
CanActivateChild | 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由的子路由能否激活。 如果所有守卫都返回 Interface that a class can implement to be a guard deciding if a child route can be activated. If all guards return |
CanDeactivate | 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由能否停用。 如果所有守卫都返回 Interface that a class can implement to be a guard deciding if a route can be deactivated. If all guards return |
CanLoad | 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由的子路由能否加载。 Interface that a class can implement to be a guard deciding if a children can be loaded. |
ExtraOptions | 表示路由器的配置项。 Represents options to configure the router. |
NavigationExtras | 表示在导航时用到的额外选项。 Represents the extra options used during navigation. |
ParamMap | 矩阵参数( Matrix and Query parameters. |
Resolve | 一个接口,某些类可以实现它以扮演一个数据提供者。 Interface that class can implement to be a data provider. |
Route | 欲知详情,参见 See |
RouterState | Represents the state of the router. |
RouterStateSnapshot | 表示路由器在当前瞬间的状态。 Represents the state of the router at a moment in time. |
UrlTree | Represents the parsed URL. |
指令
RouterLink | 让你可以在应用中链接到特定的路由。 Lets you link to specific routes in your app. |
RouterLinkActive | 当此链接指向的路由激活时,往宿主元素上添加一个 CSS 类。 Lets you add a CSS class to an element when the link's route becomes active. |
RouterLinkWithHref | 允许你在应用中链接到特定的路由。 Lets you link to specific routes in your app. |
RouterOutlet | 一个占位符,Angular 会根据当前的路由器状态动态填充它。 Acts as a placeholder that Angular dynamically fills based on the current router state. |
类型
Data | 表示与特定路由相关的静态数据。 Represents the static data associated with a particular route. |
DetachedRouteHandle | Represents the detached route tree. |
Event | 表示一个路由器事件,允许你跟踪路由器本身的生命周期。 Represents a router event, allowing you to track the lifecycle of the router. |
LoadChildren |
The type of |
LoadChildrenCallback |
The type of |
Navigation | Information about any given navigation. This information can be gotten from the router at any time using the |
PRIMARY_OUTLET | Name of the primary outlet. |
Params | A collection of parameters. |
ROUTER_CONFIGURATION | DI 用它来配置路由器。 Is used in DI to configure the router. |
ROUTER_INITIALIZER | 一个代表路由器初始化器的令牌,应用引导完毕后就会调用它。 A token for the router initializer that will be called after the app is bootstrapped. |
ROUTES | |
ResolveData | 表示与特定路由相关的解析出来的数据。 Represents the resolved data associated with a particular route. |
Routes | 表示路由器配置。 Represents router configuration. |
RunGuardsAndResolvers |
The type of |
UrlMatchResult | 表示 URL 匹配的结果。 Represents the results of the URL matching. |
UrlMatcher | 用于匹配 URL 的函数 A function matching URLs |