December 2018
Intermediate to advanced
196 pages
4h 48m
English
Now that the user can search and save photos, it’s time to add the final major component: editing a saved photo. The first requirement is simple—get a single photo from the API. While it’s possible to reuse the getSavedPhotos method and just filter down to the requested ID, it’s more elegant to have a function just for this purpose, and adding a method won’t complicate things too much. Add a getSinglePhoto method to PhotosService:
| | getSinglePhoto(photoId) { |
| | return this.http.get<IPhoto>(this.api + '/getSinglePhoto/' + photoId); |
| | } |
Next, you need to tap into that new method. Open up edit-photo.component.ts and add the following (import as needed):
Read now
Unlock full access