How to use the @rxweb/reactive-form-validators.NumericValueType.Both function in @rxweb/reactive-form-validators

To help you get started, we’ve selected a few @rxweb/reactive-form-validators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rxweb / rxweb / test / reactive-form-validators / validator / numeric.validator.spec.ts View on Github external
() => {
            let formBuilder = new FormBuilder();
            let formGroup = formBuilder.group({
              'dataType': 'Integer',
              'realNumber': -12.5
            });
            expect(RxwebValidators.numeric({ acceptValue:NumericValueType.Both,conditionalExpression: 'x => x.dataType == "Real"' })(formGroup.controls.realNumber)).toBeNull()
          });
github rxweb / rxweb / test / reactive-form-validators / validator / numeric.validator.spec.ts View on Github external
() => {
            let formBuilder = new FormBuilder();
            let formGroup = formBuilder.group({
              'dataType': 'Real',
              'realNumber': -15
            });
            expect(RxwebValidators.numeric({ acceptValue:NumericValueType.Both,conditionalExpression: 'x => x.dataType == "Real"' })(formGroup.controls.realNumber)).toBeNull()
          });
github rxweb / rxweb / test / reactive-form-validators / decorator / numeric.decorator.spec.ts View on Github external
@prop()
    dataType: string;

    @numeric({ acceptValue: NumericValueType.NegativeNumber })
    negativeNumber: number;

    @numeric({ allowDecimal: true })
    decimalNumber: number;

    //If you want to apply conditional expression of type 'function'
    @numeric({ acceptValue: NumericValueType.PositiveNumber, conditionalExpression: (x, y) => x.dataType == "Integer" })
    integerNumber: number;

    //If you want to apply conditional expression of type 'string'
    @numeric({ acceptValue: NumericValueType.Both, conditionalExpression: 'x => x.dataType == "Real"' })
    realNumber: number;

    @numeric({ message: '{{0}} is not a positive number' })
    positiveNumber: number;

}


    describe('Decorator', () => {
        let formBuilder = new RxFormBuilder();
        beforeEach(() => {
            ReactiveFormConfig.set({
                "validationMessage": {
                    "numeric": "Enter a valid numeric digit.",
                }
            });
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / validators / numeric / complete / numeric-complete.component.ts View on Github external
ngOnInit() {
        this.userInfoFormGroup = this.formBuilder.group({
            dataType:['',], 
            integerNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.PositiveNumber  ,allowDecimal:false  ,conditionalExpression:(x,y) => x.dataType == "Number"  })], 
            realNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.Both  ,allowDecimal:false  ,conditionalExpression:'x => x.dataType == "Number"' })], 
            negativeNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.NegativeNumber  ,allowDecimal:true  ,message:'{{0}} is not a negative number' })], 
        });
    }
}
github rxweb / rxweb / rxwebio / src / assets / examples / reactive-form-validators / validators / numeric / conditionalExpression / numeric-conditional-expression.component.ts View on Github external
ngOnInit() {
        this.userInfoFormGroup = this.formBuilder.group({
            dataType:['',], 
            realNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.Both  ,conditionalExpression:'x => x.dataType == "Real"' })], 
            integerNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.PositiveNumber  ,conditionalExpression:(x,y) => x.dataType == "Integer"  })], 
        });
    }
}
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / validators / numeric / conditionalExpression / numeric-conditional-expression.component.ts View on Github external
ngOnInit() {
        this.userInfoFormGroup = this.formBuilder.group({
            dataType:['',], 
            realNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.Both  ,conditionalExpression:'x => x.dataType == "Real"' })], 
            integerNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.PositiveNumber  ,conditionalExpression:(x,y) => x.dataType == "Positive"  })], 
        });
    }
}
github rxweb / rxweb / rxwebio / src / assets / examples / reactive-form-validators / validators / numeric / complete / numeric-complete.component.ts View on Github external
ngOnInit() {
        this.userInfoFormGroup = this.formBuilder.group({
            dataType:['',], 
            negativeNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.NegativeNumber })], 
            decimalNumber:['', RxwebValidators.numeric({allowDecimal:true })], 
            integerNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.PositiveNumber  ,conditionalExpression:(x,y) => x.dataType == "Integer"  })], 
            realNumber:['', RxwebValidators.numeric({acceptValue:NumericValueType.Both  ,conditionalExpression:'x => x.dataType == "Real"' })], 
            positiveNumber:['', RxwebValidators.numeric({message:'{{0}} is not a positive number' })], 
        });
    }
}
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / decorators / numeric / conditionalExpression / user-info.model.ts View on Github external
import {  numeric,prop, NumericValueType, } from "@rxweb/reactive-form-validators"

export class UserInfo {

	@prop()
	dataType: string;

	//If you want to apply conditional expression of type 'string'
	@numeric({acceptValue:NumericValueType.Both  ,conditionalExpression:'x => x.dataType == "Real"' }) 
	realNumber: number;

	//If you want to apply conditional expression of type 'function'
	@numeric({acceptValue:NumericValueType.PositiveNumber  ,conditionalExpression:(x,y) => x.dataType == "Positive"  }) 
	integerNumber: number;

}
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / decorators / numeric / complete / user-info.model.ts View on Github external
import {  numeric,prop, NumericValueType, } from "@rxweb/reactive-form-validators"

export class UserInfo {

	@prop()
	dataType: string;

	//If you want to apply conditional expression of type 'function'
	@numeric({acceptValue:NumericValueType.PositiveNumber  ,allowDecimal:false  ,conditionalExpression:(x,y) => x.dataType == "Number"  }) 
	integerNumber: number;

	//If you want to apply conditional expression of type 'string'
	@numeric({acceptValue:NumericValueType.Both  ,allowDecimal:false  ,conditionalExpression:'x => x.dataType == "Number"' }) 
	realNumber: number;

	@numeric({acceptValue:NumericValueType.NegativeNumber  ,allowDecimal:true  ,message:'{{0}} is not a negative number' }) 
	negativeNumber: number;

}
github rxweb / rxweb / rxwebio / src / assets / examples / reactive-form-validators / decorators / numeric / complete / user-info.model.ts View on Github external
@numeric({allowDecimal:true }) 
	decimalNumber: number;
	
	
	

	//If you want to apply conditional expression of type 'function'
	@numeric({acceptValue:NumericValueType.PositiveNumber  ,conditionalExpression:(x,y) => x.dataType == "Integer"  }) 
	integerNumber: number;
	
	
	

	//If you want to apply conditional expression of type 'string'
	@numeric({acceptValue:NumericValueType.Both  ,conditionalExpression:'x => x.dataType == "Real"' }) 
	realNumber: number;
	
	
	

	@numeric({message:'{{0}} is not a positive number' }) 
	positiveNumber: number;
	
	
	

}

@rxweb/reactive-form-validators

[![Build Status](https://dev.azure.com/ajayojha/rxweb/_apis/build/status/rxweb-CI?branchName=master)](https://dev.azure.com/ajayojha/rxweb/_build/latest?definitionId=39&branchName=master) [![Gitter](https://badges.gitter.im/rx-web/Lobby.svg)](https://git

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis