Skip to content

Commit f178e08

Browse files
committed
docs(angular): remove periods and add ()
1 parent 32c1a4b commit f178e08

File tree

12 files changed

+74
-74
lines changed

12 files changed

+74
-74
lines changed

docs/angular/your-first-app.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ Next, import `@ionic/pwa-elements` by editing `src/main.ts`.
111111
```ts
112112
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
113113
import { AppModule } from './app/app.module';
114-
// CHANGE: Add the following import.
114+
// CHANGE: Add the following import
115115
import { defineCustomElements } from '@ionic/pwa-elements/loader';
116116

117-
// CHANGE: Call the element loader before the `bootstrapModule` call.
117+
// CHANGE: Call the element loader before the `bootstrapModule` call
118118
defineCustomElements(window);
119119

120120
platformBrowserDynamic()

docs/angular/your-first-app/2-taking-photos.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Open the new `services/photo.service.ts` file, and let’s add the logic that wi
2525

2626
```ts
2727
import { Injectable } from '@angular/core';
28-
// CHANGE: Add the following imports.
28+
// CHANGE: Add the following imports
2929
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
3030
import { Filesystem, Directory } from '@capacitor/filesystem';
3131
import { Preferences } from '@capacitor/preferences';
@@ -45,7 +45,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
4545
import { Preferences } from '@capacitor/preferences';
4646

4747
export class PhotoService {
48-
// CHANGE: Add the gallery function.
48+
// CHANGE: Add the gallery method
4949
public async addNewToGallery() {
5050
// Take a photo
5151
const capturedPhoto = await Camera.getPhoto({
@@ -63,7 +63,7 @@ Next, in `tab2.page.ts`, import the `PhotoService` class and add a method to cal
6363

6464
```ts
6565
import { Component } from '@angular/core';
66-
// CHANGE: Import the PhotoService.
66+
// CHANGE: Import the PhotoService
6767
import { PhotoService } from '../services/photo.service';
6868

6969
@Component({
@@ -73,10 +73,10 @@ import { PhotoService } from '../services/photo.service';
7373
standalone: false,
7474
})
7575
export class Tab2Page {
76-
// CHANGE: Update constructor to include `photoService`.
76+
// CHANGE: Update constructor to include `photoService`
7777
constructor(public photoService: PhotoService) {}
7878

79-
// CHANGE: Add `addNewToGallery` method.
79+
// CHANGE: Add `addNewToGallery()` method
8080
addPhotoToGallery() {
8181
this.photoService.addNewToGallery();
8282
}
@@ -125,7 +125,7 @@ export class PhotoService {
125125
// ...existing code...
126126
}
127127

128-
// CHANGE: Add the `UserPhoto` interface.
128+
// CHANGE: Add the `UserPhoto` interface
129129
export interface UserPhoto {
130130
filepath: string;
131131
webviewPath?: string;
@@ -136,7 +136,7 @@ Above the `addNewToGallery()` method, define an array of `UserPhoto`, which will
136136

137137
```ts
138138
export class PhotoService {
139-
// CHANGE: Add the `photos` array.
139+
// CHANGE: Add the `photos` array
140140
public photos: UserPhoto[] = [];
141141

142142
public async addNewToGallery() {
@@ -148,7 +148,7 @@ export class PhotoService {
148148
Over in the `addNewToGallery` method, add the newly captured photo to the beginning of the `photos` array.
149149

150150
```ts
151-
// CHANGE: Update `addNewToGallery()` method.
151+
// CHANGE: Update `addNewToGallery()` method
152152
public async addNewToGallery() {
153153
// Take a photo
154154
const capturedPhoto = await Camera.getPhoto({
@@ -157,7 +157,7 @@ public async addNewToGallery() {
157157
quality: 100
158158
});
159159

160-
// CHANGE: Add the new photo to the photos array.
160+
// CHANGE: Add the new photo to the photos array
161161
this.photos.unshift({
162162
filepath: "soon...",
163163
webviewPath: capturedPhoto.webPath!

docs/angular/your-first-app/3-saving-photos.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { Preferences } from '@capacitor/preferences';
2929
export class PhotoService {
3030
// ...existing code...
3131

32-
// CHANGE: Add the `savePicture()` method.
32+
// CHANGE: Add the `savePicture()` method
3333
private async savePicture(photo: Photo) {
3434
return {
3535
filepath: 'soon...',
@@ -58,7 +58,7 @@ import { Preferences } from '@capacitor/preferences';
5858
export class PhotoService {
5959
public photos: UserPhoto[] = [];
6060

61-
// CHANGE: Update the `addNewToGallery()` method.
61+
// CHANGE: Update the `addNewToGallery()` method
6262
public async addNewToGallery() {
6363
// Take a photo
6464
const capturedPhoto = await Camera.getPhoto({
@@ -67,7 +67,7 @@ export class PhotoService {
6767
quality: 100,
6868
});
6969

70-
// CHANGE: Add `savedImageFile`.
70+
// CHANGE: Add `savedImageFile`
7171
// Save the picture and add it to photo collection
7272
const savedImageFile = await this.savePicture(capturedPhoto);
7373

@@ -107,7 +107,7 @@ import { Preferences } from '@capacitor/preferences';
107107
export class PhotoService {
108108
// ...existing code...
109109

110-
// CHANGE: Update the `savePicture()` method.
110+
// CHANGE: Update the `savePicture()` method
111111
private async savePicture(photo: Photo) {
112112
// Fetch the photo, read as a blob, then convert to base64 format
113113
const response = await fetch(photo.webPath!);
@@ -130,7 +130,7 @@ export class PhotoService {
130130
};
131131
}
132132

133-
// CHANGE: Add the `convertBlobToBase64` method.
133+
// CHANGE: Add the `convertBlobToBase64` method
134134
private convertBlobToBase64(blob: Blob) {
135135
return new Promise((resolve, reject) => {
136136
const reader = new FileReader();

docs/angular/your-first-app/4-loading-photos.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Open `photo.service.ts` and begin by defining a new property in the `PhotoServic
2323
export class PhotoService {
2424
public photos: UserPhoto[] = [];
2525

26-
// CHANGE: Add a key for photo storage.
26+
// CHANGE: Add a key for photo storage
2727
private PHOTO_STORAGE: string = 'photos';
2828

2929
// ...existing code...
@@ -45,7 +45,7 @@ public async addNewToGallery() {
4545

4646
this.photos.unshift(savedImageFile);
4747

48-
// CHANGE: Add method to cache all photo data for future retrieval.
48+
// CHANGE: Add method to cache all photo data for future retrieval
4949
Preferences.set({
5050
key: this.PHOTO_STORAGE,
5151
value: JSON.stringify(this.photos),
@@ -59,7 +59,7 @@ With the photo array data saved, create a new public method in the `PhotoService
5959
export class PhotoService {
6060
// ...existing code...
6161

62-
// CHANGE: Add the method to load the photo data.
62+
// CHANGE: Add the method to load the photo data
6363
public async loadSaved() {
6464
// Retrieve cached photo array data
6565
const { value: photoList } = await Preferences.get({ key: this.PHOTO_STORAGE });
@@ -74,13 +74,13 @@ On mobile (coming up next!), we can directly set the source of an image tag - `<
7474
export class PhotoService {
7575
// ...existing code...
7676

77-
// CHANGE: Update the `loadSaved` method.
77+
// CHANGE: Update the `loadSaved()` method
7878
public async loadSaved() {
7979
// Retrieve cached photo array data
8080
const { value: photoList } = await Preferences.get({ key: this.PHOTO_STORAGE });
8181
this.photos = (photoList ? JSON.parse(photoList) : []) as UserPhoto[];
8282

83-
// CHANGE: Display the photo by reading into base64 format.
83+
// CHANGE: Display the photo by reading into base64 format
8484
for (let photo of this.photos) {
8585
// Read each saved photo's data from the Filesystem
8686
const file = await Filesystem.file({
@@ -175,7 +175,7 @@ export interface UserPhoto {
175175
}
176176
```
177177

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.
179179

180180
Update `tab2.page.ts` to look like the following:
181181

@@ -192,7 +192,7 @@ import { PhotoService } from '../services/photo.service';
192192
export class Tab2Page {
193193
constructor(public photoService: PhotoService) {}
194194

195-
// CHANGE: Add call to `loadSaved` when navigating to the Photos tab.
195+
// CHANGE: Add call to `loadSaved()` when navigating to the Photos tab
196196
async ngOnInit() {
197197
await this.photoService.loadSaved();
198198
}

docs/angular/your-first-app/5-adding-mobile.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ import { Injectable } from '@angular/core';
2626
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
2727
import { Filesystem, Directory } from '@capacitor/filesystem';
2828
import { Preferences } from '@capacitor/preferences';
29-
// CHANGE: Add import.
29+
// CHANGE: Add import
3030
import { Platform } from '@ionic/angular';
3131

3232
export class PhotoService {
3333
public photos: UserPhoto[] = [];
3434

3535
private PHOTO_STORAGE: string = 'photos';
3636

37-
// CHANGE: Add a property to track the app's running platform.
37+
// CHANGE: Add a property to track the app's running platform
3838
private platform: Platform;
3939

40-
// CHANGE: Update constructor to set `platform`.
40+
// CHANGE: Update constructor to set `platform`
4141
constructor(platform: Platform) {
4242
this.platform = platform;
4343
}
@@ -53,11 +53,11 @@ First, we’ll update the photo saving functionality to support mobile. In the `
5353
Update `savePicture()` to look like the following:
5454

5555
```ts
56-
// CHANGE: Update the `savePicture()` method.
56+
// CHANGE: Update the `savePicture()` method
5757
private async savePicture(photo: Photo) {
5858
let base64Data: string | Blob;
5959

60-
// CHANGE: Add platform check.
60+
// CHANGE: Add platform check
6161
// "hybrid" will detect Cordova or Capacitor
6262
if (this.platform.is('hybrid')) {
6363
// Read the file into base64 format
@@ -98,7 +98,7 @@ import { Capacitor } from '@capacitor/core';
9898
Then update `savePicture()` to look like the following:
9999

100100
```ts
101-
// CHANGE: Update `savePicture()` method.
101+
// CHANGE: Update `savePicture()` method
102102
private async savePicture(photo: Photo) {
103103
let base64Data: string | Blob;
104104
// "hybrid" will detect mobile - iOS or Android
@@ -122,7 +122,7 @@ private async savePicture(photo: Photo) {
122122
directory: Directory.Data,
123123
});
124124

125-
// CHANGE: Add platform check.
125+
// CHANGE: Add platform check
126126
if (this.platform.is('hybrid')) {
127127
// Display the new image by rewriting the 'file://' path to HTTP
128128
return {
@@ -143,12 +143,12 @@ private async savePicture(photo: Photo) {
143143
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:
144144

145145
```ts
146-
// CHANGE: Update `loadSaved` method.
146+
// CHANGE: Update `loadSaved()` method
147147
public async loadSaved() {
148148
const { value: photoList } = await Preferences.get({ key: this.PHOTO_STORAGE });
149149
this.photos = (photoList ? JSON.parse(photoList) : []) as UserPhoto[];
150150

151-
// CHANGE: Add platform check.
151+
// CHANGE: Add platform check
152152
// If running on the web...
153153
if (!this.platform.is('hybrid')) {
154154
for (let photo of this.photos) {

docs/angular/your-first-app/7-live-reload.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { Capacitor } from '@capacitor/core';
5151
export class PhotoService {
5252
// ...existing code...
5353

54-
// CHANGE: Add `deletePhoto()` method.
54+
// CHANGE: Add `deletePhoto()` method
5555
public async deletePhoto(photo: UserPhoto, position: number) {
5656
// Remove this photo from the Photos reference data array
5757
this.photos.splice(position, 1);
@@ -82,10 +82,10 @@ Next, in `tab2.page.ts`, implement the `showActionSheet()` method. We're adding
8282

8383
```ts
8484
import { Component } from '@angular/core';
85-
// Change: Add import.
85+
// Change: Add import
8686
import type { UserPhoto } from '../services/photo.service';
8787
import { PhotoService } from '../services/photo.service';
88-
// CHANGE: Add import.
88+
// CHANGE: Add import
8989
import { ActionSheetController } from '@ionic/angular';
9090

9191
@Component({
@@ -95,12 +95,12 @@ import { ActionSheetController } from '@ionic/angular';
9595
standalone: false,
9696
})
9797
export class Tab2Page {
98-
// CHANGE: Update constructor.
98+
// CHANGE: Update constructor
9999
constructor(public photoService: PhotoService, public actionSheetController: ActionSheetController) {}
100100

101101
// ...existing code...
102102

103-
// CHANGE: Add `showActionSheet` method.
103+
// CHANGE: Add `showActionSheet()` method
104104
public async showActionSheet(photo: UserPhoto, position: number) {
105105
const actionSheet = await this.actionSheetController.create({
106106
header: 'Photos',

versioned_docs/version-v7/angular/your-first-app.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ Next, import `@ionic/pwa-elements` by editing `src/main.ts`.
111111
```ts
112112
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
113113
import { AppModule } from './app/app.module';
114-
// CHANGE: Add the following import.
114+
// CHANGE: Add the following import
115115
import { defineCustomElements } from '@ionic/pwa-elements/loader';
116116

117-
// CHANGE: Call the element loader before the `bootstrapModule` call.
117+
// CHANGE: Call the element loader before the `bootstrapModule` call
118118
defineCustomElements(window);
119119

120120
platformBrowserDynamic()

versioned_docs/version-v7/angular/your-first-app/2-taking-photos.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Open the new `services/photo.service.ts` file, and let’s add the logic that wi
2525

2626
```ts
2727
import { Injectable } from '@angular/core';
28-
// CHANGE: Add the following imports.
28+
// CHANGE: Add the following imports
2929
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
3030
import { Filesystem, Directory } from '@capacitor/filesystem';
3131
import { Preferences } from '@capacitor/preferences';
@@ -45,7 +45,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
4545
import { Preferences } from '@capacitor/preferences';
4646

4747
export class PhotoService {
48-
// CHANGE: Add the gallery function.
48+
// CHANGE: Add the gallery method
4949
public async addNewToGallery() {
5050
// Take a photo
5151
const capturedPhoto = await Camera.getPhoto({
@@ -63,7 +63,7 @@ Next, in `tab2.page.ts`, import the `PhotoService` class and add a method to cal
6363

6464
```ts
6565
import { Component } from '@angular/core';
66-
// CHANGE: Import the PhotoService.
66+
// CHANGE: Import the PhotoService
6767
import { PhotoService } from '../services/photo.service';
6868

6969
@Component({
@@ -73,10 +73,10 @@ import { PhotoService } from '../services/photo.service';
7373
standalone: false,
7474
})
7575
export class Tab2Page {
76-
// CHANGE: Update constructor to include `photoService`.
76+
// CHANGE: Update constructor to include `photoService`
7777
constructor(public photoService: PhotoService) {}
7878

79-
// CHANGE: Add `addNewToGallery` method.
79+
// CHANGE: Add `addNewToGallery()` method
8080
addPhotoToGallery() {
8181
this.photoService.addNewToGallery();
8282
}
@@ -125,7 +125,7 @@ export class PhotoService {
125125
// ...existing code...
126126
}
127127

128-
// CHANGE: Add the `UserPhoto` interface.
128+
// CHANGE: Add the `UserPhoto` interface
129129
export interface UserPhoto {
130130
filepath: string;
131131
webviewPath?: string;
@@ -136,7 +136,7 @@ Above the `addNewToGallery()` method, define an array of `UserPhoto`, which will
136136

137137
```ts
138138
export class PhotoService {
139-
// CHANGE: Add the `photos` array.
139+
// CHANGE: Add the `photos` array
140140
public photos: UserPhoto[] = [];
141141

142142
public async addNewToGallery() {
@@ -148,7 +148,7 @@ export class PhotoService {
148148
Over in the `addNewToGallery` method, add the newly captured photo to the beginning of the `photos` array.
149149

150150
```ts
151-
// CHANGE: Update `addNewToGallery()` method.
151+
// CHANGE: Update `addNewToGallery()` method
152152
public async addNewToGallery() {
153153
// Take a photo
154154
const capturedPhoto = await Camera.getPhoto({
@@ -157,7 +157,7 @@ public async addNewToGallery() {
157157
quality: 100
158158
});
159159

160-
// CHANGE: Add the new photo to the photos array.
160+
// CHANGE: Add the new photo to the photos array
161161
this.photos.unshift({
162162
filepath: "soon...",
163163
webviewPath: capturedPhoto.webPath!

0 commit comments

Comments
 (0)