Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 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
49210d3
docs(angular): update your first app pages
thetaPC Oct 28, 2025
5b41def
Merge branch 'main' into angularPhotoGalleryCodeContext
thetaPC Oct 28, 2025
a4e4db6
Correct typo in deployment message
thetaPC Oct 28, 2025
c3a34a9
docs(angular): update your first app pages for v7
thetaPC Oct 29, 2025
899f1ea
docs(angular): update distribute pages
thetaPC Oct 30, 2025
4d23054
docs(angular): remove first header
thetaPC Oct 31, 2025
c0d4ea8
docs(angular): update your first app pages
thetaPC Oct 31, 2025
cc3843f
docs(angular): update taking photos pages
thetaPC Oct 31, 2025
1e4305e
docs(angular): change wording
thetaPC Oct 31, 2025
32c1a4b
docs(angular): change existing code text
thetaPC Oct 31, 2025
f178e08
docs(angular): remove periods and add ()
thetaPC Oct 31, 2025
3139c48
docs(angular): move note
thetaPC Oct 31, 2025
7e46c17
docs(angular): add deployment word
thetaPC Oct 31, 2025
1122ed6
docs(angular): change to important
thetaPC Oct 31, 2025
c0b36f1
Update docs/angular/your-first-app/7-live-reload.md
thetaPC Oct 31, 2025
a55294f
Update docs/angular/your-first-app/5-adding-mobile.md
thetaPC Oct 31, 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
92 changes: 66 additions & 26 deletions docs/angular/your-first-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ sidebar_label: Build Your First App
---

<head>
<title>Build Your First Ionic Mobile App: Angular Development Tutorial</title>
<title>Build Your First Ionic Mobile App with Angular | Ionic Capacitor Camera</title>
<meta
name="description"
content="Ionic's single codebase builds for any platform using just HTML, CSS, & JavaScript. Develop your first mobile app with our step-by-step Angular tutorial."
content="This Angular tutorial teaches the fundamentals of Ionic app development by creating a realistic app step-by-step. Learn to run your first Ionic app with Angular."
/>
</head>

Expand All @@ -34,11 +34,11 @@ 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).
Find the [complete app code](https://github.com/ionic-team/tutorial-photo-gallery-angular) referenced in this guide on GitHub.

## Download Required Tools

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 All @@ -71,7 +70,7 @@ Consider setting up npm to operate globally without elevated permissions. See [R

## Create an App

Next, create an Ionic Angular app that uses the Tabs starter template and adds Capacitor for native functionality:
Next, create an Ionic Angular app that uses the "Tabs" starter template and adds Capacitor for native functionality:

```shell
ionic start photo-gallery tabs --type=angular --capacitor
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 @@ -128,55 +134,89 @@ ionic serve

And voilà! Your Ionic app is now running in a web browser. Most of your app can be built and tested right in the browser, greatly increasing development and testing speed.

## Photo Gallery!!!
## 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.
Copy link
Member

@brandyscarney brandyscarney Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than changing these paths to relative links like ../api/fab.md should we use /docs/api/fab.md? That way they will be right even if this gets moved down or up a directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do that, then we wouldn't be able to directly jump to those files using an IDE. I get a warning that the file doesn't exist when I CMD+Left_Mouse_Click


```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