January 2018
Intermediate to advanced
332 pages
7h 36m
English
So far, what we have declared in the states (or routes) is the path and the component that we want to go with them. What Angular does allow us to do is add a new property called data to the route configuration. This allows us to add any data that we would like regarding any route. In our case, it works out very well because we want to be able to toggle routes based on the keys a user presses.
So, let's take an example route that we have defined previously:
import { HomeComponent } from './home.component';export const HomeRoutes = [ { path: 'home', component: HomeComponent },];export const HomeComponents = [ HomeComponent];
We will now modify this and add the new data property to the route configuration:
import ...Read now
Unlock full access