Skip to content

Commit

Permalink
fix(angular-getting-started): type errors (#2688)
Browse files Browse the repository at this point in the history
Co-authored-by: Greg Billetdeaux <gregadeaux@gmail.com>
Co-authored-by: Maria Hutt <maria@ionic.io>
  • Loading branch information
3 people authored Apr 24, 2023
1 parent 1ff738a commit d8b91fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/angular/your-first-app/4-loading-photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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...
}
Expand Down
4 changes: 2 additions & 2 deletions docs/angular/your-first-app/5-adding-mobile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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”
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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”
Expand Down

0 comments on commit d8b91fe

Please sign in to comment.