@angular/router
package
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.
Entry points
Primary
@angular/router | Implements the Angular Router service , which enables navigation from one view to the next as users perform application tasks. |
Secondary
@angular/router/testing | Supplies a testing module for the Angular |
@angular/router/upgrade | Provides support for upgrading routing applications from Angular JS to Angular. |
Primary entry point exports
NgModules
RouterModule | Adds router directives and providers. |
Classes
ActivationEnd | An event triggered at the end of the activation part of the Resolve phase of routing. |
ActivationStart | An event triggered at the start of the activation part of the Resolve phase of routing. |
ChildActivationEnd | An event triggered at the end of the child-activation part of the Resolve phase of routing. |
ChildActivationStart | An event triggered at the start of the child-activation part of the Resolve phase of routing. |
ChildrenOutletContexts | Store contextual information about the children (= nested) |
DefaultUrlSerializer | A default implementation of the |
GuardsCheckEnd | An event triggered at the end of the Guard phase of routing. |
GuardsCheckStart | An event triggered at the start of the Guard phase of routing. |
NavigationCancel | An event triggered when a navigation is canceled, directly or indirectly. |
NavigationEnd | An event triggered when a navigation ends successfully. |
NavigationError | An event triggered when a navigation fails due to an unexpected error. |
NavigationStart | 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 | An event triggered at the end of the Resolve phase of routing. |
ResolveStart | An event triggered at the the start of the Resolve phase of routing. |
RouteConfigLoadEnd | An event triggered when a route has been lazy loaded. |
RouteConfigLoadStart | An event triggered before lazy loading a route configuration. |
RouteReuseStrategy | Provides a way to customize when activated routes get reused. |
Router | A service that provides navigation and URL manipulation capabilities. |
RouterEvent | Base for events the router goes through, as opposed to events tied to a specific route. Fired one time for any given navigation. |
RouterPreloader | The preloader optimistically loads all router configurations to make navigations into lazily-loaded sections of the application faster. |
RoutesRecognized | An event triggered when routes are recognized. |
Scroll | An event triggered by scrolling. |
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. |
Functions
convertToParamMap | |
provideRoutes | Registers a DI provider for a set of routes. |
Structures
ActivatedRoute | Provides access to information about a route associated with a component that is loaded in an outlet. Use to traverse the |
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 children can be loaded. |
ExtraOptions | A set of configuration options for a router module, provided in the |
NavigationExtras | Options that modify the navigation strategy. |
ParamMap | A map that provides access to the required and optional parameters specific to a route. The map supports retrieving a single value with |
Resolve | Interface that classes can implement to be a data provider. A data provider class can be used with the router to resolve data during navigation. The interface defines a |
Route | A configuration object that defines a single route. A set of routes are collected in a |
RouterState | Represents the state of the router as a tree of activated routes. |
RouterStateSnapshot | Represents the state of the router at a moment in time. |
UrlTree | Represents the parsed URL. |
Directives
RouterLink | Lets you link to specific routes in your app. |
RouterLinkActive | 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 | Acts as a placeholder that Angular dynamically fills based on the current router state. |
Types
Data | Represents static data associated with a particular route. |
DeprecatedLoadChildren | Deprecated: the A string of the form |
DetachedRouteHandle | Represents the detached route tree. |
Event | Router events that allow you to track the lifecycle of the router. |
InitialNavigation | Allowed values in an |
LoadChildren | A string of the form |
LoadChildrenCallback | A function that is called to resolve a collection of lazy-loaded routes. |
Navigation | Information about a navigation operation. Retrieve the most recent navigation object with the |
PRIMARY_OUTLET | The primary routing outlet. |
Params | A collection of matrix and query URL parameters. |
QueryParamsHandling | How to handle query parameters in a router link. One of:
|
ROUTER_CONFIGURATION | A DI token for the router service. |
ROUTER_INITIALIZER | A DI token for the router initializer that is called after the app is bootstrapped. |
ROUTES | The DI token for a router configuration. |
ResolveData | Represents the resolved data associated with a particular route. |
Routes | Represents a route configuration for the Router service. An array of |
RunGuardsAndResolvers | A policy for when to run guards and resolvers on a route. |
UrlMatchResult | Represents the result of matching URLs with a custom matching function. |
UrlMatcher | A function for matching a route against URLs. Implement a custom URL matcher for |
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v9.angular.io/api/router