Configuring Route definitions
Route definitions represent association of one or more URL paths to the respective components. Each of these route definitions can also be termed as a route. Route definitions or routes, are stored in an array and loaded using Router.forRoot
or Router.forChild
API depending upon whether routes are defined at root level or submodule/feature module level. When the users click on the hyperlink (URL), the router looks for the corresponding route, and based on appropriate path matching strategy (prefix by default) determines the component to display. The following are the key steps to configure route definitions:
- Define route definitions in the form of an array of routes. The following code represents route definitions where no parameters are passed (such as new user registration and user login), and one where parameters are passed (such as to get information for doctors, patients, hospitals, and so on).
Note that the path will have no leading slashes (
/
). The Router...