Between
The Between rule checks that a numeric value falls inside a given range, exclusive of both endpoints — so between:5,10 accepts 6, 7, 8, and 9, but rejects 5 and 10 themselves. This is the key difference from the Range rule, which is inclusive of its boundary values. Both the field's value and the two comparison bounds are automatically cast to numbers before the check runs, so it works reliably whether they arrive as strings or numbers. It's the right choice whenever a limit needs to be a strict, open boundary — for example, a discount percentage that must stay strictly between 0 and 100, never touching either extreme.
#Directive Code Snippet
<!DOCTYPE html>
<html lang="en">
...
<form (ngSubmit)="onSubmit(form)" #form="ngForm">
<input [bwtenn]="[5,10]" 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]="between:5,10" 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('between:5,10',<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>