I have the below routes, with id being an optional parameter, so the user could load info, or if no id is supplied they could add info. I would like to be able to reuse the component so that the page does not have to reload (api calls in ngOnInit) however because they are two seperate routes angular always creates a whole new component and ngOnInit is called.
I have tried using children but still get the same problem
(this is with the angular 4 router)
const routes: Routes = [
{
path: 'stuff/info',
component: InfoComponent,
},
{
path: 'stuff/info/:id',
component: InfoComponent,
},
]
