Angular 2: Passing Data to Routes By @YFain | @ThingsExpo #IoT
In the previous blog I did a high-level overview of Angular 2 router and wrote a basic routing application that demonstrated displaying different components in a predefined area of the window. We often need not only display a component, but also pass some data to it.
For example, if we navigate from the Home to the Product Detail route we need to pass the product ID to the destination route. Angular offers a directive RouteParams so a route can receive data from the parent component. There is also a RouteData directive that can be used to pass additional data to a route from the @RouteConfig section. I’ll illustrate the use of both directives by modifying the app from the previous blog.
Subscribe to Applenews247.Com Newsletter