The Routes Array
Let's explore how the routes are set up using the Routes array.
What is the Routes array?
The Route array contains a set of objects that define the details of the Route.
The interface of the Route
object
If we quickly look at the interface that defines what Route
object properties are, we can see that there are a number of properties available to us:
interface Route {
path?: string
pathMatch?: string
matcher?: UrlMatcher
component?: Type<any>
redirectTo?: string
outlet?: string
canActivate?: any[]
canActivateChild?: any[]
canDeactivate?: any[]
canLoad?: any[]
data?: Data
resolve?: ResolveData
children?: Routes
loadChildren?: LoadChildren
runGuardsAndResolvers?: RunGuardsAndResolvers
}
📝 Note: This is the interface that defines a
Route
in Angular.
As you can see, there are a lot of different properties we can use to create a route
array. This array of Route
objects makes up a model of how the application will ...