negative
Validate that a numeric value is strictly less than zero.
Signature
NguardValidators.Number.negative: ValidatorFn
A parameterless validator — used directly without invocation.
Reactive forms
import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';
const temperature = new FormControl('', [NguardValidators.Number.negative]);
Template-driven forms
<input ngModel name="temperature" nguardNegative />
Error key
{ negative: true }
Notes
- The check is strict (
< 0). Zero fails. - Numeric strings work —
'-5'passes;'0'fails. null,undefined, empty string,NaN,Infinityall fail.