How to use the @rxweb/reactive-form-validators.RxwebValidators.required 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 / services / class-abstraction.spec.ts View on Github external
export class Record {
    @required()
    name: string;
}

export class Order extends Record {
    id: number;
    tenantId: number;
    @required() lineItem: string;
}

export class User {

    @compose({ validators: [RxwebValidators.alpha(), RxwebValidators.required()] })
    firstName: string;

}
export class Model extends User {

    @required()
    lastName: string;
}



describe('class abstraction', () => {
    let formbuilder = new RxFormBuilder();

    it('should pass, current class property should be defined as RxFormControl', () => {
        let userFormGroup = formbuilder.formGroup(Order)
github rxweb / rxweb / test / reactive-form-validators / validator / required.validator.spec.ts View on Github external
() => {
          let formBuilder = new FormBuilder();
          let formGroup = formBuilder.group({
			'firstName':['Bharat'],
            'lastName':''
          });
          expect(RxwebValidators.required({conditionalExpression:'x => x.firstName == "Bharat"'})(formGroup.controls.lastName)).toEqual({'required':{ message: 'This field is required', refValues: [  ] } }); 
        });
github rxweb / rxweb / rxwebio / src / assets / examples / howto / validators / errorMessages / complete / errormessage-complete.component.ts View on Github external
ngOnInit() {
        this.userFormGroup = this.formBuilder.group({
            userName:['', RxwebValidators.required()], 
              password : ['',[RxwebValidators.alpha(),RxwebValidators.password({ validation: { maxLength: 10, minLength: 5, digit: true, specialCharacter: true } })]],
        });
      
    }
}
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / validators / required / message / required-message.component.ts View on Github external
ngOnInit() {
        this.userFormGroup = this.formBuilder.group({
            userName:['', RxwebValidators.required({message:'Username cannot be blank.' })], 
        });
    }
}
github rxweb / rxweb / rxwebio / src / assets / examples / reactive-form-validators / validators / required / complete / required-complete.component.ts View on Github external
ngOnInit() {
        this.userFormGroup = this.formBuilder.group({
            firstName:['', RxwebValidators.required()], 
            middleName:['', RxwebValidators.required({conditionalExpression:(x,y) => x.firstName == "Bharat"  })], 
            lastName:['', RxwebValidators.required({conditionalExpression:'x => x.firstName == "Bharat"' })], 
            userName:['', RxwebValidators.required({message:'Username cannot be blank.' })], 
        });
    }
}
github rxweb / rxweb / rxweb.io / src / app / components / home / home.component.ts View on Github external
ngOnInit(): void {
    this.userFormGroup = this.formBuilder.group({
      password: ['',],
      confirmPassword: ['', RxwebValidators.compare({ fieldName: 'password' })],
    });
    this.userForm = this.formBuilder.group({
      country:[''],
      identityNumber:['',RxwebValidators.required({conditionalExpression:(x) => x.country == 'India' })]
    });
    this.user = new User();
    this.userInfoFormGroup = this.rxFormBuilder.formGroup(this.user);
    this.http.get('assets/json/home.json').subscribe((response:object) => {
        this.codeContent = response;
    this.http.get('assets/json/dynamic-validation.json').subscribe((dynamicValidationConfiguration:any) => {
      
        this.userModelFormGroup = this.rxFormBuilder.group({
          firstName:['Bharat']
        },
        new FormBuilderConfiguration( { dynamicValidation: dynamicValidationConfiguration }));
        this.showComponent= true;
      });
    })
  }
github rxweb / rxweb / rxwebio / src / assets / examples / reactive-form-validators / validators / required / add / required-add.component.ts View on Github external
ngOnInit() {
        this.userInfoFormGroup = this.formBuilder.group({
            firstName:['', RxwebValidators.required()], 
        });
    }
}
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / validators / required / complete / required-complete.component.ts View on Github external
ngOnInit() {
        this.userFormGroup = this.formBuilder.group({
            firstName:['', RxwebValidators.required()], 
            middleName:['', RxwebValidators.required({conditionalExpression:(x,y) => x.firstName == "Bharat"  })], 
            lastName:['', RxwebValidators.required({conditionalExpression:'x => x.firstName == "Bharat"' })], 
            userName:['', RxwebValidators.required({message:'Username cannot be blank.' })], 
        });
    }
}
github rxweb / rxweb / rxwebio / src / app / components / home / home.component.ts View on Github external
ngOnInit(): void {
    this.isLoggedIn = false;
    if (localStorage.getItem('isLoggedIn') === 'true') {
      this.isLoggedIn = true;
    }
    this.applicationBroadcast.urlBroadCast(true);
    this.userFormGroup = this.formBuilder.group({
      password: ['',],
      confirmPassword: ['', RxwebValidators.compare({ fieldName: 'password' })],
    });
    this.userForm = this.formBuilder.group({
      country:[''],
      identityNumber:['',RxwebValidators.required({conditionalExpression:(x) => x.country == 'India' })]
    });
    this.user = new User();
    this.userInfoFormGroup = this.rxFormBuilder.formGroup(this.user);
    this.http.get('assets/json/home.json?v='+environment.appVersion).subscribe((response:object) => {
        this.codeContent = response;
    this.http.get('assets/json/dynamic-validation.json?v='+environment.appVersion).subscribe((dynamicValidationConfiguration:any) => {
      
        this.userModelFormGroup = this.rxFormBuilder.group({
          firstName:['Bharat']
        },
        new FormBuilderConfiguration( { dynamicValidation: dynamicValidationConfiguration }));
        this.showComponent= true;
      });
    })
  }
github rxweb / rxweb / rxweb.io / src / assets / examples / reactive-form-validators / validators / required / add / required-add.component.ts View on Github external
ngOnInit() {
        this.userInfoFormGroup = this.formBuilder.group({
            firstName:['', RxwebValidators.required()], 
        });
    }
}

@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