Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validators: [
{
validator: (control: AbstractControl) => {
let isValid: boolean = (!control.value && control.value !== 0) || control.value % 2 !== 0;
return !isValid ? { odd: true } : undefined;
},
},
],
},
];
multipleValidatorTypes: ITdDynamicElementConfig[] = [
{
name: 'passwordElement',
label: 'Password',
type: TdDynamicElement.Password,
required: true,
validators: [
{
validator: (control: AbstractControl) => {
let isValid: boolean = /\d/i.test(control.value);
return !isValid ? { oneNumber: true } : undefined;
},
},
{
validator: (control: AbstractControl) => {
let isValid: boolean = control.value && control.value.length >= 8 && control.value.length <= 20;
return !isValid ? { length: true } : undefined;
},
},
{
validator: (control: AbstractControl) => {
validators: [
{
validator: (control: AbstractControl) => {
const isValid: boolean = (!control.value && control.value !== 0) || control.value % 2 !== 0;
return !isValid ? { odd: true } : undefined;
},
},
],
},
];
multipleValidatorTypes: ITdDynamicElementConfig[] = [
{
name: 'passwordElement',
label: 'Password',
type: TdDynamicElement.Password,
required: true,
validators: [
{
validator: (control: AbstractControl) => {
const isValid: boolean = /\d/i.test(control.value);
return !isValid ? { oneNumber: true } : undefined;
},
},
{
validator: (control: AbstractControl) => {
const isValid: boolean = control.value && control.value.length >= 8 && control.value.length <= 20;
return !isValid ? { length: true } : undefined;
},
},
{
validator: (control: AbstractControl) => {
type: TdDynamicType.Text,
required: false,
default: 'Default',
flex: 50,
disabled: true,
},
{
name: 'textarea',
hint: 'this is a textarea hint',
type: TdDynamicElement.Textarea,
required: false,
},
{
name: 'required-password',
label: 'Password Label',
type: TdDynamicElement.Password,
required: true,
},
];
}
type: TdDynamicType.Text,
required: false,
default: 'Default',
flex: 50,
disabled: true,
},
{
name: 'textarea',
hint: 'this is a textarea hint',
type: TdDynamicElement.Textarea,
required: false,
},
{
name: 'required-password',
label: 'Password Label',
type: TdDynamicElement.Password,
required: true,
},
];
numberElements: ITdDynamicElementConfig[] = [
{
name: 'number',
label: 'Number',
type: TdDynamicType.Number,
required: true,
min: 18,
max: 70,
},
{
name: 'slider',
type: TdDynamicElement.Slider,
type: TdDynamicType.Text,
required: false,
default: 'Default',
flex: 50,
disabled: true,
},
{
name: 'textarea',
hint: 'this is a textarea hint',
type: TdDynamicElement.Textarea,
required: false,
},
{
name: 'required-password',
label: 'Password Label',
type: TdDynamicElement.Password,
required: true,
},
];
numberElements: ITdDynamicElementConfig[] = [
{
name: 'number',
label: 'Number',
type: TdDynamicType.Number,
required: true,
min: 18,
max: 70,
},
{
name: 'slider',
type: TdDynamicElement.Slider,
validators: [
{
validator: (control: AbstractControl) => {
let isValid: boolean = control.value.length <= 2;
return !isValid ? { invalidChips: true } : undefined;
},
},
],
},
];
elementOptions: any[] = [
TdDynamicElement.Input,
TdDynamicType.Number,
TdDynamicElement.Datepicker,
TdDynamicElement.Password,
TdDynamicElement.Textarea,
TdDynamicElement.Slider,
TdDynamicElement.Checkbox,
TdDynamicElement.SlideToggle,
TdDynamicElement.FileInput,
];
showDynamicCode: boolean = false;
type: any;
count: number = 2;
customValidationElements: ITdDynamicElementConfig[] = [
{
name: 'evenElement',
validators: [
{
validator: (control: AbstractControl) => {
const isValid: boolean = control.value.length <= 2;
return !isValid ? { invalidChips: true } : undefined;
},
},
],
},
];
elementOptions: any[] = [
TdDynamicElement.Input,
TdDynamicType.Number,
TdDynamicElement.Datepicker,
TdDynamicElement.Password,
TdDynamicElement.Textarea,
TdDynamicElement.Slider,
TdDynamicElement.Checkbox,
TdDynamicElement.SlideToggle,
TdDynamicElement.FileInput,
];
showDynamicCode: boolean = false;
type: any;
count: number = 2;
customValidationElements: ITdDynamicElementConfig[] = [
{
name: 'evenElement',