Define custom properties on Angular's reactive form controls
npm install @kbru/control-propsExtend Angular's reactive FormGroups and FormControls with custom properties.
Use Cases:
- Mark a form field as visible/invisible instead of enabled/disabled without affecting the behaviour of the form.
- Attach valid values to a control for the template to display them. Useful for select, radio, ...
``shell`
npm install @kbru/control-props
`typescript
import { FormGroupWithProps } from '@kbru/control-props';
import { FormControlWithProps } from '@kbru/control-props';
interface Props {
visible: boolean;
options?: string[];
}
export class Component {
form = new FormGroupWithProps
{ visible: true },
{
field: new FormControlWithProps
select: new FormControlWithProps
visible: true,
options: ['Foo', 'Bar'],
}),
}
);
}
`
`html
``