Generate an RFC compliant vCard and download it.
npm install ngx-vcard





Almost fully RFC compliant vCard
Formatter, that also can download the generated vCard. Outputs VCard version 4.
Maybe other version will be supported.
If you want to have another Property, please open up an issue or even better
provide a PR. ;)
1. Install from npm
``bash`
$ npm install ngx-vcard --save
2. Import in app.module.ts:
`typescript
import { NgxVcardModule } from "ngx-vcard";
@NgModule({
imports: [NgxVcardModule],
})
export class AppModule {}
`

`typescript
/ example.component.ts /
import { Component } from "@angular/core";
import { VCard } from "ngx-vcard";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"],
})
export class AppComponent {
public vCard: VCard = {
name: {
firstNames: "John",
lastNames: "Doe",
},
};
public generateVCardOnTheFly = (): VCard => {
// TODO: Generate the VCard before Download
return {
name: { firstNames: "John", lastNames: "Doe", addtionalNames: "Auto" },
};
};
}
`
`html`

`typescript
/ example.component.ts /
import { Component } from "@angular/core";
import { VCardFormatter, VCard } from "ngx-vcard";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"],
})
export class AppComponent {
public vCard: VCard = {
name: {
firstNames: "John",
lastNames: "Doe",
},
};
public vCardString = VCardFormatter.getVCardAsString(this.vCard);
public ngOnInit() {
console.log(this.vCardString);
}
}
`
` VCard String: {{vCardString}}html`
This project is heavily inspired from the
vCards-js Package from Eric J Nesser.
- VCard Version 4 - https://tools.ietf.org/html/rfc6350
- VCard Version 3 - https://www.ietf.org/rfc/rfc2426.txt A Story about
everything:
https://alessandrorossini.org/the-sad-story-of-the-vcard-format-and-its-lack-of-interoperability/

> There is already a newer Angular Version than listed here?
> Install the latest version of this package with npm install ngx-vcard --legacy-peer-deps` or add it via overrides.
> Report your findings as an issue so I can add support or fix a problem.
| Angular Version | Package Version | Comment |
| --------------- | --------------- | -------------------------- |
| 17.x - 18.x | 5.x | drops IE support |
| <=18.x | <=4.x | supports Internet Explorer |
| <=10.x | <=3.x | supports Internet Explorer |
| <=9.x | <=2.x | supports Internet Explorer |