Ipv6
The IPv6 rule checks that a field holds a valid IPv6 address — the newer, longer format like 2001:0db8:85a3::8a2e:0370:7334, written as eight groups of hexadecimal digits separated by colons, with support for the double-colon shorthand that collapses one run of consecutive zero groups. It's the right check for a field that's specifically scoped to modern IPv6 infrastructure, such as a server's public-facing address in an IPv6-only deployment, a DNS AAAA record value, or a network config field where the system explicitly expects the newer address format and an IPv4 value would be out of place. If the field should accept either address family, use the broader IP rule instead; IPv4 is the counterpart for the legacy dotted-quad format.
#Directive Code Snippet
<!DOCTYPE html>
<html lang="en">
...
<form (ngSubmit)="onSubmit(form)" #form="ngForm">
<input ipv6 type="text" name="<name>" [(ngModel)]="<name>" #<name>="ngModel">
<ng-absolute-validator [formInstance]="<name>"></ng-absolute-validator>
</form>
...
</html>
#Chain Rule Code Snippet
<!DOCTYPE html>
<html lang="en">
...
<form (ngSubmit)="onSubmit(form)" #form="ngForm">
<input rule="ipv6" type="text" name="<name>" [(ngModel)]="<name>" #<name>="ngModel">
<ng-absolute-validator [formInstance]="<name>"></ng-absolute-validator>
</form>
...
</html>
#Reactive Form Code Snippet
//component.ts
export class ReactiveComponent{
public form !: FormGroup;
constructor(
private fb : FormBuilder,
private rv : ReactiveValidator,
){this.generteForm()}
generteForm(){
this.form = this.fb.group({
<name> : ['',this.rv.map('ipv6',<CUSTOM_MESSAGE>)]
})
}
}
//component.html
<!DOCTYPE html>
<html lang="en">
...
<form [formGroup]="form">
<input type="text" name="<name>" formControlName="<name>">
<ng-absolute-validator [formInstance]="form.get(<name>)"></ng-absolute-validator>
</form>
...
</html>