Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
() => {
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: [ ] } });
});
ngOnInit() {
this.userFormGroup = this.formBuilder.group({
userName:['', RxwebValidators.required()],
password : ['',[RxwebValidators.alpha(),RxwebValidators.password({ validation: { maxLength: 10, minLength: 5, digit: true, specialCharacter: true } })]],
});
}
}
ngOnInit() {
this.userFormGroup = this.formBuilder.group({
userName:['', RxwebValidators.required({message:'Username cannot be blank.' })],
});
}
}
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.' })],
});
}
}
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;
});
})
}
ngOnInit() {
this.userInfoFormGroup = this.formBuilder.group({
firstName:['', RxwebValidators.required()],
});
}
}
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.' })],
});
}
}
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;
});
})
}
ngOnInit() {
this.userInfoFormGroup = this.formBuilder.group({
firstName:['', RxwebValidators.required()],
});
}
}