I am new to angular 2; I am using typescript to program the components, I have a "product" object where upon landing to the website, the user sees a list of all products (JSON data coming from a RESTful endpoint). If that user clicks on one of the products from the list, it will take them to an "edit" page where all the details of that product is populated into form fields for the user to edit. My question is, how can I program this in angular 2? Most examples I see online do the editing on the same page (component) as the view.
- My project structure:
- product (model)
- product.service (service) --> gets data from RESTful end point
- product.component (component) --> loads all products and displays in list
- edit.component (component) --> displays all data from selected product, also using reactive form controls within HTML
- using angular 2 version 4
I am thinking of using the endpoint (e.g. /api/product?id=xxx) but need to know how to pass the parameter of the product id from the selection made from the product.component
Thanks!