You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/angular/build-options.md
+69
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,41 @@ export class HomePage {
113
113
}
114
114
```
115
115
116
+
Icons can also be registered in entry points such as `app.component.ts` to avoid the need to call `addIcons` multiple times. Developers should be aware that the initial application chunk may increase because the registered icons will need to be loaded at application start. However, if your application uses a small number of icons the impact of this may be minimal.
117
+
118
+
```typescript title="app.component.ts"
119
+
import { Component } from'@angular/core';
120
+
import { addIcons } from'ionicons';
121
+
import { logoIonic } from'ionicons/icons';
122
+
123
+
@Component({
124
+
selector: 'app-root',
125
+
templateUrl: 'app.component.html',
126
+
styleUrls: ['app.component.scss'],
127
+
standalone: true,
128
+
})
129
+
exportclassAppComponent {
130
+
constructor() {
131
+
/**
132
+
* Any icons you want to use in your application
133
+
* can be registered in app.component.ts and then
134
+
* referenced by name anywhere in your application.
135
+
*/
136
+
addIcons({ logoIonic });
137
+
}
138
+
}
139
+
```
140
+
141
+
Icons registered in an application entry point can then be referenced by name anywhere in the application.
142
+
143
+
```html title="home.page.html"
144
+
<!--
145
+
logoIonic was registered in app.component.ts instead of home.page.ts,
146
+
but it can still be used in home.page.html.
147
+
-->
148
+
<ion-iconname="logo-ionic"></ion-icon>
149
+
```
150
+
116
151
**Routing**
117
152
118
153
Developers who wish to use `routerLink`, `routerAction`, or `routerDirection` on Ionic components should import the `IonRouterLink` directive. Developers who wish to use these routing features on anchor (`<a>`) elements should import `IonRouterLinkWithHref` instead.
@@ -218,6 +253,40 @@ export class HomePage {
218
253
}
219
254
```
220
255
256
+
Icons can also be registered in entry points such as `app.component.ts` to avoid the need to call `addIcons` multiple times. Developers should be aware that the initial application chunk may increase because the registered icons will need to be loaded at application start. However, if your application uses a small number of icons the impact of this may be minimal.
257
+
258
+
```typescript title="app.component.ts"
259
+
import { Component } from'@angular/core';
260
+
import { addIcons } from'ionicons';
261
+
import { logoIonic } from'ionicons/icons';
262
+
263
+
@Component({
264
+
selector: 'app-root',
265
+
templateUrl: 'app.component.html',
266
+
styleUrls: ['app.component.scss'],
267
+
})
268
+
exportclassAppComponent {
269
+
constructor() {
270
+
/**
271
+
* Any icons you want to use in your application
272
+
* can be registered in app.component.ts and then
273
+
* referenced by name anywhere in your application.
274
+
*/
275
+
addIcons({ logoIonic });
276
+
}
277
+
}
278
+
```
279
+
280
+
Icons registered in an application entry point can then be referenced by name anywhere in the application.
281
+
282
+
```html title="home.page.html"
283
+
<!--
284
+
logoIonic was registered in app.component.ts instead of home.page.ts,
285
+
but it can still be used in home.page.html.
286
+
-->
287
+
<ion-iconname="logo-ionic"></ion-icon>
288
+
```
289
+
221
290
**Routing**
222
291
223
292
Developers who wish to use `routerLink`, `routerAction`, or `routerDirection` on Ionic components should import the `IonRouterLink` directive. Developers who wish to use these routing features on anchor (`<a>`) elements should import `IonRouterLinkWithHref` instead.
0 commit comments