I don't fully understand how to use the ActivatedRoute service. In my application the code to create or edit a user is exactly the same with the only difference being that an "edit" first queries for the current values from a webservice whereas the "create" does not.
What I'd like to have is a route like so:
{path: 'client/:id', component: ClientEditComponent}
and then if the :id
is provided I'm doing an edit, and if not I'm doing a create. There's so many different ways that I've seen of reading from the ActivatedRoute
service that I don't know what's right at this point.
Am I just looking at snapshot, do I subscribe to something, etc...