Skip to content

Icon example not working - Update your-first-app.md #3320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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
33 changes: 30 additions & 3 deletions docs/angular/your-first-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ And voilà! Your Ionic app is now running in a web browser. Most of your app can

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!

![Before and after going through this tutorial](/img/guides/first-app-cap-ng/email-photogallery.gif)

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

```html
Expand Down Expand Up @@ -158,12 +156,41 @@ We put the visual aspects of our app into `<ion-content>`. In this case, it’s
<ion-content>
<ion-fab vertical="bottom" horizontal="center" slot="fixed">
<ion-fab-button>
<ion-icon name="camera"></ion-icon>
<ion-icon [icon]="camera"></ion-icon>
</ion-fab-button>
</ion-fab>
</ion-content>
```

At this point, you will notice a `Failed to construct 'URL': Invalid base URL` error in the console of your app. Open the `tab2.page.ts` file and import the `camera` icon from `ionicons/icons` and assign it to the `camera` class variable.

```ts
import { Component } from '@angular/core';
import { IonHeader, IonToolbar, IonTitle, IonContent, IonFab, IonFabButton, IonIcon } from '@ionic/angular/standalone';
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
import { camera } from 'ionicons/icons';

@Component({
selector: 'app-tab2',
templateUrl: 'tab2.page.html',
styleUrls: ['tab2.page.scss'],
standalone: true,
imports: [
IonHeader,
IonToolbar,
IonTitle,
IonContent,
IonFab,
IonFabButton,
IonIcon,
ExploreContainerComponent,
],
})
export class Tab2Page {
camera = camera;
}
```

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

```html
Expand Down