Skip to content

Commit 5343c84

Browse files
Add support for Angular 21 (#481)
1 parent 204c473 commit 5343c84

File tree

16 files changed

+3029
-4158
lines changed

16 files changed

+3029
-4158
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
55

66
---
7+
## [4.0.0](https://github.com/FortAwesome/angular-fontawesome/releases/tag/3.1.0) (2025-11-24)
8+
9+
### Added
10+
11+
* Support for Angular 21.
12+
13+
### Removed
14+
15+
* Angular 20.x is no longer supported. If you are using this version, please, stick with version 3.0.0.
716

817
## [3.0.0](https://github.com/FortAwesome/angular-fontawesome/releases/tag/3.0.0) (2025-08-03)
918

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ $ npm install @fortawesome/angular-fontawesome@<version>
4040

4141
### Compatibility table
4242

43-
| @fortawesome/angular-fontawesome | Angular | Font Awesome |
44-
|----------------------------------|------------|-------------------|
45-
| 3.x | 20.x | 5.x && 6.x && 7.x |
46-
| 2.x | 20.x | 5.x && 6.x |
47-
| 1.x | 19.x | 5.x && 6.x |
43+
| @fortawesome/angular-fontawesome | Angular | Font Awesome |
44+
|----------------------------------|---------|-------------------|
45+
| 4.x | 21.x | 5.x && 6.x && 7.x |
46+
| 3.x | 20.x | 5.x && 6.x && 7.x |
47+
| 2.x | 20.x | 5.x && 6.x |
48+
| 1.x | 19.x | 5.x && 6.x |
4849

4950
See [the compatibility page](./docs/guide/compatibility.md) for older versions.
5051

angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"defaultConfiguration": "production"
2525
},
2626
"test": {
27-
"builder": "@angular-devkit/build-angular:karma",
27+
"builder": "@angular/build:karma",
2828
"options": {
2929
"include": ["src/**/*.spec.ts", "testing/src/**/*.spec.ts"],
3030
"polyfills": ["zone.js", "zone.js/testing"],

docs/guide/adding-css.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ For Font Awesome icon to render properly, it needs global Font Awesome styles to
55
If you have issues with this approach, you can disable it by setting `FaConfig.autoAddCss` to `false`:
66

77
```typescript
8+
import { inject } from '@angular/core';
89
import { FaConfig } from '@fortawesome/angular-fontawesome';
910

1011
export class AppComponent {
11-
constructor(faConfig: FaConfig) {
12+
constructor() {
13+
const faConfig = inject(FaConfig);
1214
faConfig.autoAddCss = false;
1315
}
1416
}

docs/guide/testing.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ There are several options how to deal with the icon library in the tests:
6363
With this approach you would define a new module, which wraps `FontAwesomeModule` and configures an icon library. Then this module can be used instead of `FontAwesomeModule` both in the `AppModule` and test code thus the icon library configuration is shared between application and tests. Below is the example of such wrapper module:
6464

6565
```typescript
66-
import { NgModule } from '@angular/core';
66+
import { inject, NgModule } from '@angular/core';
6767
import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
6868
import { faUser } from '@fortawesome/free-solid-svg-icons';
6969

@@ -72,7 +72,8 @@ import { faUser } from '@fortawesome/free-solid-svg-icons';
7272
exports: [FontAwesomeModule],
7373
})
7474
class FontAwesomeIconsModule {
75-
constructor(library: FaIconLibrary) {
75+
constructor() {
76+
const library = inject(FaIconLibrary);
7677
library.addIcons(faUser);
7778
}
7879
}

docs/usage/icon-library.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Icons should be registered only once in the `AppComponent`'s constructor using `
2424
1. Add icon to the library with `library.addIcons(faCoffee)`.
2525

2626
```typescript
27-
import { Component } from '@angular/core';
27+
import { Component, inject } from '@angular/core';
2828
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
2929
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
3030

@@ -34,8 +34,9 @@ import { faCoffee } from '@fortawesome/free-solid-svg-icons';
3434
templateUrl: './app.component.html',
3535
})
3636
export class AppComponent {
37-
constructor(library: FaIconLibrary) {
37+
constructor() {
3838
// Add an icon to the library for convenient access in other components
39+
const library = inject(FaIconLibrary);
3940
library.addIcons(faCoffee);
4041
}
4142
}
@@ -49,7 +50,8 @@ import { fas } from '@fortawesome/free-solid-svg-icons';
4950
import { far } from '@fortawesome/free-regular-svg-icons';
5051

5152
export class AppComponent {
52-
constructor(library: FaIconLibrary) {
53+
constructor() {
54+
const library = inject(FaIconLibrary);
5355
library.addIconPacks(fas, far);
5456
}
5557
}
@@ -62,7 +64,7 @@ A better way can be to use a [Font Awesome Kit](https://fontawesome.com/kits) to
6264
_In these examples, you would replace "KIT_CODE" with the unique identifier for your Pro Kit_
6365

6466
```typescript
65-
import { Component } from '@angular/core';
67+
import { Component, inject } from '@angular/core';
6668
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
6769
import { all } from '@awesome.me/kit-KIT_CODE/icons';
6870

@@ -72,8 +74,9 @@ import { all } from '@awesome.me/kit-KIT_CODE/icons';
7274
templateUrl: './app.component.html',
7375
})
7476
export class AppComponent {
75-
constructor(library: FaIconLibrary) {
77+
constructor() {
7678
// Add an icon to the library for convenient access in other components
79+
const library = inject(FaIconLibrary);
7780
library.addIcons(...all);
7881
}
7982
}
@@ -99,7 +102,8 @@ The default prefix, `fas`, can be adjusted by injecting the `FaConfig` and modif
99102
import { FaConfig } from '@fortawesome/angular-fontawesome';
100103

101104
export class AppComponent {
102-
constructor(faConfig: FaConfig) {
105+
constructor() {
106+
const faConfig = inject(FaConfig);
103107
faConfig.defaultPrefix = 'far';
104108
}
105109
}
@@ -113,7 +117,8 @@ The fixed width class, `fa-fw`, can be applied globally by injecting the `FaConf
113117
import { FaConfig } from '@fortawesome/angular-fontawesome';
114118

115119
export class AppComponent {
116-
constructor(faConfig: FaConfig) {
120+
constructor() {
121+
const faConfig = inject(FaConfig);
117122
faConfig.fixedWidth = true;
118123
}
119124
}

docs/usage/using-other-styles.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ import { faStar as fasStar } from '@fortawesome/free-solid-svg-icons';
124124
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
125125

126126
export class AppModule {
127-
constructor(library: FaIconLibrary) {
127+
constructor() {
128128
// Add multiple icons to the library
129+
const library = inject(FaIconLibrary);
129130
library.addIcons(fasStar, farStar);
130131
}
131132
}

karma.conf.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
module.exports = function (config) {
55
config.set({
66
basePath: '',
7-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
7+
frameworks: ['jasmine'],
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
1111
require('karma-jasmine-html-reporter'),
1212
require('karma-coverage'),
13-
require('@angular-devkit/build-angular/plugins/karma'),
1413
],
1514
client: {
1615
clearContext: false, // leave Jasmine Spec Runner output visible in browser

package.json

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,36 @@
2929
},
3030
"homepage": "https://github.com/FortAwesome/angular-fontawesome",
3131
"devDependencies": {
32-
"@angular-devkit/build-angular": "patch:@angular-devkit/build-angular@npm%3A20.0.0#~/.yarn/patches/@angular-devkit-build-angular-npm-19.0.0-131974ef98.patch",
33-
"@angular-devkit/core": "^20.3.1",
34-
"@angular-devkit/schematics": "^20.3.1",
35-
"@angular/animations": "^20.3.0",
36-
"@angular/build": "^20.3.1",
37-
"@angular/cli": "^20.3.1",
38-
"@angular/common": "^20.3.0",
39-
"@angular/compiler": "^20.3.0",
40-
"@angular/compiler-cli": "^20.3.0",
41-
"@angular/core": "^20.3.0",
42-
"@angular/language-service": "^20.3.0",
43-
"@angular/platform-browser": "^20.3.0",
44-
"@angular/platform-browser-dynamic": "^20.3.0",
45-
"@angular/platform-server": "^20.3.0",
46-
"@angular/router": "^20.3.0",
47-
"@angular/ssr": "^20.3.1",
48-
"@fortawesome/free-regular-svg-icons": "^7.0.0",
49-
"@fortawesome/free-solid-svg-icons": "^7.0.0",
50-
"@types/express": "^4.17.21",
32+
"@angular-devkit/build-angular": "patch:@angular-devkit/build-angular@npm%3A21.0.0#~/.yarn/patches/@angular-devkit-build-angular-npm-19.0.0-131974ef98.patch",
33+
"@angular-devkit/core": "^21.0.0",
34+
"@angular-devkit/schematics": "^21.0.0",
35+
"@angular/animations": "^21.0.0",
36+
"@angular/build": "^21.0.0",
37+
"@angular/cli": "^21.0.0",
38+
"@angular/common": "^21.0.0",
39+
"@angular/compiler": "^21.0.0",
40+
"@angular/compiler-cli": "^21.0.0",
41+
"@angular/core": "^21.0.0",
42+
"@angular/language-service": "^21.0.0",
43+
"@angular/platform-browser": "^21.0.0",
44+
"@angular/platform-browser-dynamic": "^21.0.0",
45+
"@angular/platform-server": "^21.0.0",
46+
"@angular/router": "^21.0.0",
47+
"@angular/ssr": "^21.0.0",
48+
"@fortawesome/free-regular-svg-icons": "^7.1.0",
49+
"@fortawesome/free-solid-svg-icons": "^7.1.0",
50+
"@types/express": "^4.17.25",
5151
"@types/jasmine": "~4.3.6",
52-
"@types/node": "~22.9.1",
53-
"@typescript-eslint/eslint-plugin": "^8.33.0",
54-
"@typescript-eslint/parser": "^8.33.0",
55-
"angular-eslint": "^19.6.0",
52+
"@types/node": "~22.9.4",
53+
"@typescript-eslint/eslint-plugin": "^8.48.0",
54+
"@typescript-eslint/parser": "^8.48.0",
55+
"angular-eslint": "^21.0.1",
5656
"browser-sync": "^3.0.4",
57-
"chromedriver": "~137.0.0",
58-
"eslint": "^8.57.1",
59-
"eslint-config-prettier": "^9.1.0",
60-
"eslint-plugin-import": "2.31.0",
61-
"eslint-plugin-jsdoc": "^46.10.1",
57+
"chromedriver": "~142.0.3",
58+
"eslint": "^9.39.1",
59+
"eslint-config-prettier": "^10.1.8",
60+
"eslint-plugin-import": "2.32.0",
61+
"eslint-plugin-jsdoc": "^61.4.1",
6262
"eslint-plugin-prefer-arrow": "1.2.3",
6363
"express": "^4.21.2",
6464
"jasmine-core": "~4.5.0",
@@ -68,17 +68,17 @@
6868
"karma-coverage": "~2.2.1",
6969
"karma-jasmine": "~5.1.0",
7070
"karma-jasmine-html-reporter": "^2.1.0",
71-
"ng-packagr": "^20.0.0",
72-
"prettier": "3.5.3",
71+
"ng-packagr": "^21.0.0",
72+
"prettier": "3.6.2",
7373
"protractor": "~7.0.0",
7474
"rxjs": "^7.8.2",
7575
"ts-node": "~10.9.2",
76-
"typescript": "~5.8.3",
77-
"typescript-eslint": "^8.33.0",
76+
"typescript": "^5.9.3",
77+
"typescript-eslint": "^8.48.0",
7878
"zone.js": "~0.15.1"
7979
},
8080
"dependencies": {
81-
"@fortawesome/fontawesome-svg-core": "^7.0.0",
81+
"@fortawesome/fontawesome-svg-core": "^7.1.0",
8282
"tslib": "^2.8.1"
8383
},
8484
"keywords": [
@@ -90,7 +90,7 @@
9090
"svg"
9191
],
9292
"peerDependencies": {
93-
"@angular/core": "^20.0.0"
93+
"@angular/core": "^21.0.0"
9494
},
9595
"schematics": "./schematics/collection.json",
9696
"packageManager": "[email protected]"

projects/demo/karma.conf.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
module.exports = function (config) {
55
config.set({
66
basePath: '',
7-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
7+
frameworks: ['jasmine'],
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
1111
require('karma-jasmine-html-reporter'),
1212
require('karma-coverage'),
13-
require('@angular-devkit/build-angular/plugins/karma'),
1413
],
1514
client: {
1615
clearContext: false, // leave Jasmine Spec Runner output visible in browser

0 commit comments

Comments
 (0)