]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-forms/dynamic-form-field.component.ts
Handle input error in custom input text
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / dynamic-form-field.component.ts
1 import { Component, Input } from '@angular/core'
2 import { FormGroup } from '@angular/forms'
3 import { RegisterClientFormFieldOptions } from '@shared/models'
4
5 @Component({
6 selector: 'my-dynamic-form-field',
7 templateUrl: './dynamic-form-field.component.html',
8 styleUrls: [ './dynamic-form-field.component.scss' ]
9 })
10
11 export class DynamicFormFieldComponent {
12 @Input() form: FormGroup
13 @Input() formErrors: any
14 @Input() setting: RegisterClientFormFieldOptions
15
16 hasDedicatedFormError () {
17 const dedicated = new Set<RegisterClientFormFieldOptions['type']>([
18 'input-checkbox',
19 'input',
20 'select',
21 'input-textarea'
22 ])
23
24 return dedicated.has(this.setting.type)
25 }
26 }