I'm fairly new to Angular2 and I'm trying to edit and add elements to my database. To edit them I configured elements/:id so that goes off to the DB and pulls the element back. You can update it and all good. However when I try to add, in theory I could have exactly the same form but I wouldn't have an id because that's assigned by the backend so I don't really know if I am overloading the element.detail.component and I should be creating a new one just for add.
I also thought in adding a new route like elements/addnew and give it priority over the one above or just have a complete new one.
Updated:
My routing so far:
{ path: 'elements', component: ElementsComponent },
{ path: 'elements/:id', component: ElementDetailComponent },
If I use the option of the query string how could I make a distinction between a new element and pull all elements according to the route above?