#Same route different uuid paramater

10 messages · Page 1 of 1 (latest)

rapid sentinel
#

I have a list with [routerlink]="['/articles', object.uuid]" But when visited one and click on other same article different uuid it doenst load after the route once is launched?

iron apex
#

What do you mean by "it doesn't load"?
My gues is that your route component doesn't handle the fact that parameters can change.

rapid sentinel
#

I mean by 'it doenst load' that when the second time same route different uuid i see in address bar its changed but not the view

iron apex
#

Okay. Then what I said is probably the problem. Your route component must deal with the fact that route parameters can change. You have to subscribe or use withComponentInputBinding and properly handle the input changing. I would recommend the latter.

#

That's why ActivatedRoute#params is an observable. It will emit again when the parameters change.

rapid sentinel
#

Thanks! Do you prefer a good way?

iron apex
#

I prefer withComponentInputBinding, because it makes more like any other Angular component. But if you need to load data in response to the params you might want to stick with using ActivatedRoute#params so you can use switchMap to load the data every time.

rapid sentinel
#

Cant seem to fix it.. i must use @Input uuid? and set with ComponentInputBinding to. true.

iron apex
#

That is one path to fixing it, but doing just that won't magically fix it. You still need to update your component so that it can handle its input data changing.

#

If you are using @Input then that would mean implementing ngOnChanges.