Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9c0859d
docs(angular): add context to code blocks in your-first-app page
soundproofboot Jun 13, 2025
e979ea8
docs(angular): add context to code blocks and note to learn more abou…
soundproofboot Jun 13, 2025
67d1164
docs(angular): add context to method definitions, additional code blo…
soundproofboot Jun 13, 2025
ebb2a94
docs(angular): add context in code blocks, clarity, storage note in 4…
soundproofboot Jun 16, 2025
2660f4c
docs(angular): add context and clarity to code blocks in 5-adding-mob…
soundproofboot Jun 16, 2025
08cf534
docs(angular): ran linter to format changes to angular walk through
soundproofboot Jun 16, 2025
19727c5
docs(angular): update code comment
soundproofboot Jun 26, 2025
925be88
docs(angular): update code comment
soundproofboot Jun 26, 2025
8311b56
docs(angular): update code comment
soundproofboot Jun 26, 2025
dbba4e2
docs(angular): update code comment
soundproofboot Jun 26, 2025
6a93709
docs(angular): update code comment
soundproofboot Jun 26, 2025
6fb2f87
docs(angular): update code comment
soundproofboot Jun 26, 2025
0bf8977
docs(angular): update code comment
soundproofboot Jun 26, 2025
954c32b
docs(angular): update code comment
soundproofboot Jun 26, 2025
318444e
docs(angular): update code comment
soundproofboot Jun 26, 2025
2b7b188
docs(angular): update code comment
soundproofboot Jun 26, 2025
3a30866
docs(angular): update code comment
soundproofboot Jun 26, 2025
1a83529
docs(angular): update code comment
soundproofboot Jun 26, 2025
9c926b4
docs(angular): update code comment
soundproofboot Jun 26, 2025
082bdef
docs(angular): update code comment
soundproofboot Jun 26, 2025
ae805bb
docs(angular): update code comment
soundproofboot Jun 26, 2025
3e77409
docs(angular): remove link to ngFor docs
soundproofboot Jun 26, 2025
32fc888
docs(angular): update code block
soundproofboot Jun 26, 2025
c3ee323
docs(angular): add new line
soundproofboot Jun 26, 2025
22165d1
docs(angular): update code comment
soundproofboot Jun 26, 2025
9c6729f
docs(angular): update code comment
soundproofboot Jun 26, 2025
a5069fd
docs(angular): update code comment
soundproofboot Jun 26, 2025
35db01b
docs(angular): update language
soundproofboot Jun 26, 2025
16ade0c
docs(angular): remove code block
soundproofboot Jun 26, 2025
a21d5e8
docs(angular): update code blocks
soundproofboot Jun 26, 2025
effdaaa
docs(angular): update code blocks
soundproofboot Jun 26, 2025
2aeb4fb
docs(angular): update code blocks
soundproofboot Jun 26, 2025
20aa15b
docs(angular): update code blocks
soundproofboot Jun 26, 2025
872a89f
docs(angular): add context in localStorage and IndexedDB note
soundproofboot Jun 26, 2025
a2d98da
docs(angular): added code block
soundproofboot Jun 26, 2025
a180cad
docs(angular): add context to code blocks
soundproofboot Jun 26, 2025
977db91
docs(angular): truncate longer code blocks, fix typos
soundproofboot Jun 30, 2025
ff70a52
docs(angular): run linter
soundproofboot Jun 30, 2025
7628df1
docs(angular): update your first app page
thetaPC Oct 21, 2025
c62cb45
docs(angular): update your first app page
thetaPC Oct 22, 2025
444aeb1
docs(angular): update taking photos page
thetaPC Oct 22, 2025
9a5f1cb
docs(angular): update saving photos page
thetaPC Oct 23, 2025
b43acd1
docs(angular): remove constructor()
thetaPC Oct 23, 2025
45957b4
docs(angular): update loading photos page
thetaPC Oct 23, 2025
d954a3d
docs(angular): remove extra
thetaPC Oct 23, 2025
8cbe764
docs(angular): update adding mobile page
thetaPC Oct 24, 2025
77848e5
docs(angular): use correct method
thetaPC Oct 24, 2025
7714f0e
docs(angular): update live reload page
thetaPC Oct 24, 2025
dc6764c
docs(angular): update the your first app pages
thetaPC Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 61 additions & 21 deletions docs/angular/your-first-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ We'll create a Photo Gallery app that offers the ability to take photos with you

Highlights include:

- One Angular-based codebase that runs on the web, iOS, and Android using Ionic Framework [UI components](https://ionicframework.com/docs/components).
- One Angular-based codebase that runs on the web, iOS, and Android using Ionic Framework [UI components](../components.md).
- Deployed as a native iOS and Android mobile app using [Capacitor](https://capacitorjs.com), Ionic's official native app runtime.
- Photo Gallery functionality powered by the Capacitor [Camera](https://capacitorjs.com/docs/apis/camera), [Filesystem](https://capacitorjs.com/docs/apis/filesystem), and [Preferences](https://capacitorjs.com/docs/apis/preferences) APIs.
- Photo Gallery functionality powered by the Capacitor [Camera](../native/camera.md), [Filesystem](../native/filesystem.md), and [Preferences](../native/preferences.md) APIs.

Find the complete app code referenced in this guide [on GitHub](https://github.com/ionic-team/photo-gallery-capacitor-ng).

Expand All @@ -47,9 +47,8 @@ Download and install these right away to ensure an optimal Ionic development exp
- **Node.js** for interacting with the Ionic ecosystem. [Download the LTS version here](https://nodejs.org/en/).
- **A code editor** for... writing code! We are fans of [Visual Studio Code](https://code.visualstudio.com/).
- **Command-line interface/terminal (CLI)**:
- **Windows** users: for the best Ionic experience, we recommend the built-in command line (cmd) or the Powershell
CLI, running in Administrator mode.
- **Mac/Linux** users, virtually any terminal will work.
- **Windows** users: for the best Ionic experience, we recommend the built-in command line (cmd) or the Powershell CLI, running in Administrator mode.
- **Mac/Linux** users: virtually any terminal will work.

## Install Ionic Tooling

Expand Down Expand Up @@ -99,7 +98,7 @@ npm install @capacitor/camera @capacitor/preferences @capacitor/filesystem

### PWA Elements

Some Capacitor plugins, including the Camera API, provide the web-based functionality and UI via the Ionic [PWA Elements library](https://github.com/ionic-team/ionic-pwa-elements).
Some Capacitor plugins, including the [Camera API](../native/camera.md), provide the web-based functionality and UI via the Ionic [PWA Elements library](https://github.com/ionic-team/pwa-elements).

It's a separate dependency, so install it next:

Expand All @@ -109,11 +108,18 @@ npm install @ionic/pwa-elements

Next, import `@ionic/pwa-elements` by editing `src/main.ts`.

```tsx
```ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
// CHANGE: Add the following import.
import { defineCustomElements } from '@ionic/pwa-elements/loader';

// Call the element loader before the bootstrapModule/bootstrapApplication call
// CHANGE: Call the element loader before the `bootstrapModule` call.
defineCustomElements(window);

platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.log(err));
```

That’s it! Now for the fun part - let’s see the app in action.
Expand All @@ -130,53 +136,87 @@ And voilà! Your Ionic app is now running in a web browser. Most of your app can

## Photo Gallery!!!

There are three tabs. Click on the Tab2 tab. It’s a blank canvas, aka the perfect spot to transform into a Photo Gallery. The Ionic CLI features Live Reload, so when you make changes and save them, the app is updated immediately!
There are three tabs. Click on the "Tab2" tab. It’s a blank canvas, aka the perfect spot to transform into a Photo Gallery. The Ionic CLI features Live Reload, so when you make changes and save them, the app is updated immediately!

![Animated GIF showing the live reload feature in an Ionic app, with changes in code immediately updating the app in a web browser.](/img/guides/first-app-cap-ng/email-photogallery.gif 'Live Reload Feature in Ionic App')

Open the photo-gallery app folder in your code editor of choice, then navigate to `/src/app/tab2/tab2.page.html`. We see:
Open `/src/app/tab2/tab2.page.html`. We see:

```html
<ion-header>
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>Tab 2</ion-title>
<ion-title> Tab 2 </ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Tab 2</ion-title>
</ion-toolbar>
</ion-header>

<app-explore-container name="Tab 2 page"></app-explore-container>
</ion-content>
```

`ion-header` represents the top navigation and toolbar, with "Tab 2" as the title (there are two of them due to iOS [Collapsible Large Title](https://ionicframework.com/docs/api/title#collapsible-large-titles) support). Rename both `ion-title` elements to:
`ion-header` represents the top navigation and toolbar, with "Tab 2" as the title (there are two of them due to iOS [Collapsible Large Title](../api/title.md#collapsible-large-titles) support). Rename both `ion-title` elements to:

```html
<ion-title>Photo Gallery</ion-title>
```

We put the visual aspects of our app into `<ion-content>`. In this case, it’s where we’ll add a button that opens the device’s camera as well as displays the image captured by the camera. Start by adding a [floating action button](https://ionicframework.com/docs/api/fab) (FAB) to the bottom of the page and set the camera image as the icon.
We put the visual aspects of our app into `<ion-content>`. In this case, it’s where we’ll add a button that opens the device’s camera as well as displays the image captured by the camera. Start by adding a [floating action button](../api/fab.md) (FAB) to the bottom of the page and set the camera image as the icon.

```html
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>Photo Gallery</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Photo Gallery</ion-title>
</ion-toolbar>
</ion-header>

<!-- CHANGE: Add the floating action button. -->
<ion-fab vertical="bottom" horizontal="center" slot="fixed">
<ion-fab-button>
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab>

<!-- CHANGE: Remove or comment out `app-explore-container`. -->
<!-- <app-explore-container name="Tab 2 page"></app-explore-container> -->
</ion-content>
```

Next, open `src/app/tabs/tabs.page.html`. Change the label to “Photos” and the icon name to images”:
Next, open `src/app/tabs/tabs.page.html`. Change the label to “Photos” and the `ellipse` icon to `images` for the middle tab button.

```html
<ion-tab-button tab="tab2">
<ion-icon name="images"></ion-icon>
<ion-label>Photos</ion-label>
</ion-tab-button>
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="tab1" href="/tabs/tab1">
<ion-icon aria-hidden="true" name="triangle"></ion-icon>
<ion-label>Tab 1</ion-label>
</ion-tab-button>

<ion-tab-button tab="tab2" href="/tabs/tab2">
<!-- CHANGE: Update icon. -->
<ion-icon aria-hidden="true" name="images"></ion-icon>
<!-- CHANGE: Update label. -->
<ion-label>Photos</ion-label>
</ion-tab-button>

<ion-tab-button tab="tab3" href="/tabs/tab3">
<ion-icon aria-hidden="true" name="square"></ion-icon>
<ion-label>Tab 3</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
```

Save all changes to see them automatically applied in the browser. That’s just the start of all the cool things we can do with Ionic. Up next, implement camera taking functionality on the web, then build it for iOS and Android.
That’s just the start of all the cool things we can do with Ionic. Up next, implement camera taking functionality on the web, then build it for iOS and Android.
Loading