Form Control
Example
Step 1 - Create component
@Control({
type: 'my-input',
})
@Component({
selector: 'custom-input',
templateUrl: './input.component.html',
})
export class InputComponent {
constructor(
@Inject(FORM_CONTROL) public control: FormControl,
public question: QuestionDefinition,
@Inject(CONTROL_PROPERTIES) private properties: InputProperties
) {}
public get type(): string {
switch (this.format) {
case 'text':
return 'text';
case 'number':
return 'number';
case 'currency':
return 'number';
default:
return 'text';
}
}
public get format(): InputFormat {
return this.properties.format ?? 'text';
}
}
interface InputProperties {
format?: InputFormat;
}Step 2 - Registration
Last updated