Skip to content

Commit 9eab0cb

Browse files
authored
Merge pull request #268 from Cordobo/development
feat: angular 19 support #266
2 parents 90fda84 + 6a4f799 commit 9eab0cb

File tree

14 files changed

+8930
-8154
lines changed

14 files changed

+8930
-8154
lines changed

README.md

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
`angularx-qrcode` - a fast and easy-to-use Ivy compatible Ionic and Angular QR Code Generator library
44

5-
- Compatible with **Angular 18** and **Ionic**
6-
- Ivy compiler support, AOT, SSR (Server Side Rendering)
5+
- Compatible with **Angular 19** and **Ionic**
76
- Under active development
7+
- Standalone component support
8+
- Ivy compiler support, AOT, SSR (Server Side Rendering)
89
- Accessibility (a11y) attributes supported (alt, aria-label, title)
910
- Support for images
1011
- Trusted and used by thousands of developers like you
1112
- Easy to use, [sample web app](#demo-app) included
1213

13-
`angularx-qrcode` is compatible with Ionic 3/4/5/6/7/8 and Angular 4/5/6/7/8/9/10/11/12/13/14/15/16/17/18+ with support for the Ivy compiler. It is a drop-in replacement for the no-longer-maintained angular component ng2-qrcode and based on node-qrcode.
14+
`angularx-qrcode` is compatible with Ionic 3/4/5/6/7/8 and Angular 4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19+ with support for the Ivy compiler. It is a drop-in replacement for the no-longer-maintained angular component ng2-qrcode and based on node-qrcode.
1415

1516
- [Installation](#installation)
1617
- [Demo App](#demo-app)
@@ -22,34 +23,35 @@
2223

2324
## Installation
2425

25-
**Angular 18 and Ionic with angularx-qrcode 18**
26+
**Angular 19 and Ionic with angularx-qrcode 19**
2627

2728
```
2829
npm install angularx-qrcode --save
2930
# Or with yarn
3031
yarn add angularx-qrcode
3132
```
3233

33-
**Angular 17 and Ionic with angularx-qrcode 17**
34+
**Angular 18 and Ionic with angularx-qrcode 18**
3435

3536
```
36-
npm install angularx-qrcode@17.0.1 --save
37+
npm install angularx-qrcode@18.0.2 --save
3738
# Or with yarn
38-
yarn add angularx-qrcode@17.0.1
39+
yarn add angularx-qrcode@18.0.2
3940
```
4041

41-
**Angular 16 and Ionic with angularx-qrcode 16**
42+
**Angular 17 and Ionic with angularx-qrcode 17**
4243

4344
```
44-
npm install angularx-qrcode@16.0.2 --save
45+
npm install angularx-qrcode@17.0.1 --save
4546
# Or with yarn
46-
yarn add angularx-qrcode@16.0.2
47+
yarn add angularx-qrcode@17.0.1
4748
```
4849

4950
**All supported angular versions**
5051

5152
| Angular Version | angularx-qrcode Version |
5253
| --------------- | ----------------------- |
54+
| ^19 | ^19.0.0 |
5355
| ^18 | ^18.0.2 |
5456
| ^17 | ^17.0.1 |
5557
| ^16 | ^16.0.2 |
@@ -80,26 +82,46 @@ and open the url `http://localhost:4200/` in your browser
8082

8183
# Usage and Example Implementations
8284

83-
The source for **[a live angularx-qrcode demo app](https://cordobo.github.io/angularx-qrcode/)** and more examples how to implement angularx-qrcode is in the folder [`projects/demo-app`](projects/demo-app/src/app) in this repository.
85+
The source for **[a live angularx-qrcode demo app](https://cordobo.github.io/angularx-qrcode/)** and more examples how to implement angularx-qrcode is located in the directory [`projects/demo-app`](projects/demo-app/src/app) of this repository.
8486

85-
### Import the module and add it to your imports section in your main AppModule:
87+
### Upgrade angularx-qrcode from angularx-qrcode 18 and earlier
8688

87-
```
88-
// File: app.module.ts
89-
// all your other imports...
89+
Since Angular 19, the latest version of the angularx-qrcode module is now exported as a standalone component. If you’re upgrading from a version before Angular 19, please replace the import statement with the component’s name since it’s now a standalone component.
90+
91+
92+
````
93+
# OLD - angular 18 and older
94+
# File: app.module.ts
9095
import { QRCodeModule } from 'angularx-qrcode';
9196
92-
@NgModule({
93-
declarations: [
94-
AppComponent
95-
],
96-
imports: [
97-
QRCodeModule
98-
],
99-
providers: [],
100-
bootstrap: [AppComponent]
97+
# NEW - angular 19 and newer
98+
// File: app.component.ts
99+
import { QRCodeComponent } from 'angularx-qrcode';
100+
````
101+
For more uses with angular 18 and earlier see: [angularx/qrcode as ngModule](https://github.com/Cordobo/angularx-qrcode/tree/18.0.0)
102+
103+
104+
### Import the component and add it to your imports section in your main AppComponent:
105+
106+
107+
```
108+
// For angular 19, see above for angular 18 and older
109+
// File: app.component.ts
110+
// other imports...
111+
import { QRCodeComponent } from 'angularx-qrcode';
112+
113+
@Component({
114+
selector: "app-root",
115+
imports: [
116+
// other component imports...
117+
QRCodeComponent,
118+
],
119+
templateUrl: "./app.component.html",
120+
styleUrls: ["./app.component.css"],
101121
})
102-
export class AppModule { }
122+
export class AppComponent {
123+
// your code
124+
}
103125
```
104126

105127
```
@@ -109,10 +131,10 @@ export class AppModule { }
109131
<qrcode [qrdata]="'Your data string'" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>
110132
```
111133

112-
### Generate a QR Code from a string (directive only)
134+
### Generate a QR Code from a string
113135

114-
Now that angular/Ionic know about the new QR Code module,
115-
let's invoke it from our template with a directive.
136+
Now that angular/Ionic know about the new QR Code component,
137+
let's invoke it from our template.
116138
If we use a simple text-string, we need no additional
117139
code in our controller.
118140

angular.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@
5555
"prefix": "app",
5656
"architect": {
5757
"build": {
58-
"builder": "@angular-devkit/build-angular:browser",
58+
"builder": "@angular-devkit/build-angular:application",
5959
"options": {
6060
"allowedCommonJsDependencies": ["qrcode"],
61-
"outputPath": "dist/demo-app",
61+
"outputPath": {
62+
"base": "dist/demo-app",
63+
"browser": ""
64+
},
6265
"index": "projects/demo-app/src/index.html",
63-
"main": "projects/demo-app/src/main.ts",
64-
"polyfills": "projects/demo-app/src/polyfills.ts",
66+
"polyfills": ["projects/demo-app/src/polyfills.ts"],
6567
"tsConfig": "projects/demo-app/tsconfig.app.json",
6668
"assets": [
6769
"projects/demo-app/src/favicon.ico",
@@ -71,7 +73,8 @@
7173
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
7274
"projects/demo-app/src/styles.css"
7375
],
74-
"scripts": []
76+
"scripts": [],
77+
"browser": "projects/demo-app/src/main.ts"
7578
},
7679
"configurations": {
7780
"production": {
@@ -96,9 +99,7 @@
9699
"outputHashing": "all"
97100
},
98101
"development": {
99-
"buildOptimizer": false,
100102
"optimization": false,
101-
"vendorChunk": true,
102103
"extractLicenses": false,
103104
"sourceMap": true,
104105
"namedChunks": true

0 commit comments

Comments
 (0)