You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// CHANGE: Display the photo by reading into base64 format.
83
+
// CHANGE: Display the photo by reading into base64 format
84
84
for (let photo ofthis.photos) {
85
85
// Read each saved photo's data from the Filesystem
86
86
const file =awaitFilesystem.file({
@@ -175,7 +175,7 @@ export interface UserPhoto {
175
175
}
176
176
```
177
177
178
-
Our `PhotoService` can now load the saved images, but we'll need to update `tab2.page.ts` to put that new code to work. We'll call `loadSaved` within the [ngOnInit](https://angular.dev/guide/components/lifecycle#ngoninit) lifecycle method so that when the user first navigates to the Photo Gallery, all photos are loaded and displayed on the screen.
178
+
Our `PhotoService` can now load the saved images, but we'll need to update `tab2.page.ts` to put that new code to work. We'll call `loadSaved()` within the [ngOnInit](https://angular.dev/guide/components/lifecycle#ngoninit) lifecycle method so that when the user first navigates to the Photo Gallery, all photos are loaded and displayed on the screen.
179
179
180
180
Update `tab2.page.ts` to look like the following:
181
181
@@ -192,7 +192,7 @@ import { PhotoService } from '../services/photo.service';
192
192
exportclassTab2Page {
193
193
constructor(publicphotoService:PhotoService) {}
194
194
195
-
// CHANGE: Add call to `loadSaved` when navigating to the Photos tab.
195
+
// CHANGE: Add call to `loadSaved()` when navigating to the Photos tab
Next, add a new bit of logic in the `loadSaved()` method. On mobile, we can directly point to each photo file on the Filesystem and display them automatically. On the web, however, we must read each image from the Filesystem into base64 format. This is because the Filesystem API uses [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) under the hood. Update the `loadSaved()` method:
0 commit comments