https://github.com/stumpam/ngx-cz-id
Angular input for czech id (Rodné číslo) with validation.
https://github.com/stumpam/ngx-cz-id
angular czech id library ng rodne-cislo
Last synced: 3 months ago
JSON representation
Angular input for czech id (Rodné číslo) with validation.
- Host: GitHub
- URL: https://github.com/stumpam/ngx-cz-id
- Owner: stumpam
- License: mit
- Created: 2020-03-06T18:21:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T14:29:52.000Z (over 3 years ago)
- Last Synced: 2025-10-19T17:39:18.112Z (9 months ago)
- Topics: angular, czech, id, library, ng, rodne-cislo
- Language: TypeScript
- Homepage:
- Size: 1.84 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# NgxCzId
Angular input for czech id (Rodné číslo) with validation.
From version 4 it library uses Angular's standalone directives, so for backwards compatibility use version 3.
## Quick Start
1. Import `NgxCzIdDirective` to your project or component.
```typescript
import { NgxCzIdDirective } from '@stumpam/ngx-cz-id';
@Component({
selector: 'ngx-cz-id-root',
standalone: true,
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgxCzIdDirective],
})
export class AppComponent {}
```
2. Use in HTML template
- add attributes min or max to validate even age of person with current id
```HTML
```
Exception accepts regexp which can bypass validation of ID (rodné číslo) in cases where is needed invalid ID (010101/9999). It still validates min/max ages.
3. Optional options to emit only valid cz id value
```typescript
options: {
emitInvalid?: boolean;
// emits all typed characters not just valid / invalid complete id
emitAll?: boolean;
replaceSlashOnCopy?: boolean;
// If input is not empty, but value is not correct, on blur event it will fire validation
nonEmptyError?: boolean;
}
```
Automatically emits `invalidCzId` when length of string is valid but number is not valid id.
### Works with [formly](https://formly.dev)
and use it in the template
```HTML
```