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
Next, move over to `tab2.page.html` so we can display the image on the screen. Add a [Grid component](https://ionicframework.com/docs/api/grid) so that each photo will display nicely as photos are added to the gallery, and loop through each photo in the `PhotoServices`'s Photos array, adding an Image component (`<ion-img>`) for each. Point the `src` (source) at the photo’s path:
209
206
210
207
```html
211
208
<ion-header[translucent]="true">
212
209
<ion-toolbar>
213
-
<ion-title>
214
-
Tab 2
215
-
</ion-title>
210
+
<ion-title> Tab 2 </ion-title>
216
211
</ion-toolbar>
217
212
</ion-header>
218
213
@@ -238,9 +233,9 @@ Next, move over to `tab2.page.html` so we can display the image on the screen. A
238
233
<ion-iconname="camera"></ion-icon>
239
234
</ion-fab-button>
240
235
</ion-fab>
241
-
242
236
</ion-content>
243
237
```
238
+
244
239
:::note
245
240
Learn more about the [ngFor core directive](https://blog.angular-university.io/angular-2-ngfor/).
Obtaining the camera photo as base64 format on the web appears to be a bit trickier than on mobile. In reality, we’re just using built-in web APIs: [fetch()](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) as a neat way to read the file into blob format, then FileReader’s [readAsDataURL()](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL) to convert the photo blob to base64.
152
154
153
155
There we go! Each time a new photo is taken, it’s now automatically saved to the filesystem. Next up, we'll load and display our saved images
@@ -187,7 +188,6 @@ import { PhotoService } from '../services/photo.service';
187
188
standalone: false,
188
189
})
189
190
exportclassTab2Page {
190
-
191
191
constructor(publicphotoService:PhotoService) {}
192
192
193
193
// add call to loadSaved on navigation to Photos tab
@@ -200,6 +200,7 @@ export class Tab2Page {
200
200
}
201
201
}
202
202
```
203
+
203
204
:::note
204
205
If you're seeing broken image links or missing photos after following these steps, you may need to open your browser's
205
206
dev tools and clear both [localStorage](https://developer.chrome.com/docs/devtools/storage/localstorage) and [IndexedDB](https://developer.chrome.com/docs/devtools/storage/indexeddb).
0 commit comments