Lab 9: Observables
Objectives
- Make use of the
ActivatedRouteservice to read the parameters of the URL using observables
Instructions
- We want in our
album-detail.component.tsto have aprevious albumandnext albumbutton - Clicking on those buttons should redirect to the previous or next album using
navigateByUrltheRouter - To do so, we need to read the
idparameter of the URL in a reactive way - Instead of using a snapshot, we will use the
ActivatedRouteservice to subscribe to the changes of the parameter
route = inject(ActivatedRoute);
Then later in the code
this.route.params.subscribe(params => {
console.log(params['id']);
});
- We don't want to manage the use case of when next or previous album does not exist, we will let the user go to the
HomeComponentif that happens
TODO: Make the slide mode detailed about steps