ValidatorOptional

iban

Check an IBAN's structure and mod-97 checksum.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrInput } from 'ngwr/input';
import { WrValidators } from 'ngwr/validators';

@Component({ imports: [WrInput] })
export class MyComponent {}

Live demo

Try GB82 WEST 1234 5698 7654 32.

errors: null

Usage

import { FormControl } from '@angular/forms';
import { WrValidators } from 'ngwr/validators';

const iban = new FormControl('', [WrValidators.iban]);

iban.setValue('GB82 WEST 1234 5698 7654 32'); // valid

API

NameDescriptionTypeDefault
signatureAdd it to a validators array.ValidatorFn—
checksStructure and the ISO 13616 mod-97 checksum. The length per country is not checked.——
error keyOn failure: { iban: true }. Empty value passes.{ iban: true }—

See also