diff --git a/docs/angular/your-first-app/4-loading-photos.md b/docs/angular/your-first-app/4-loading-photos.md index 1e6896557cf..6f59d3f951f 100644 --- a/docs/angular/your-first-app/4-loading-photos.md +++ b/docs/angular/your-first-app/4-loading-photos.md @@ -35,8 +35,8 @@ With the photo array data saved, create a function called `loadSaved()` that can ```tsx public async loadSaved() { // Retrieve cached photo array data - const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + const { value } = await Preferences.get({ key: this.PHOTO_STORAGE }); + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // more to come... } diff --git a/docs/angular/your-first-app/5-adding-mobile.md b/docs/angular/your-first-app/5-adding-mobile.md index 25e18e856c9..844b87d723d 100644 --- a/docs/angular/your-first-app/5-adding-mobile.md +++ b/docs/angular/your-first-app/5-adding-mobile.md @@ -93,8 +93,8 @@ Next, head back over to the `loadSaved()` function we implemented for the web ea ```tsx public async loadSaved() { // Retrieve cached photo array data - const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + const { value } = await Preferences.get({ key: this.PHOTO_STORAGE }); + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // Easiest way to detect when running on the web: // “when the platform is NOT hybrid, do this” diff --git a/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md b/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md index 1e6896557cf..fdc2c4f3c8f 100644 --- a/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md +++ b/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md @@ -36,7 +36,7 @@ With the photo array data saved, create a function called `loadSaved()` that can public async loadSaved() { // Retrieve cached photo array data const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // more to come... } diff --git a/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md b/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md index 25e18e856c9..481d4c16ca9 100644 --- a/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md +++ b/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md @@ -94,7 +94,7 @@ Next, head back over to the `loadSaved()` function we implemented for the web ea public async loadSaved() { // Retrieve cached photo array data const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // Easiest way to detect when running on the web: // “when the platform is NOT hybrid, do this”