Axiom Form
Online Demo
Stackblitz Source Demo
Installation
Install component package from npm :
npm install axiom-form
Import component module :
;; ... ...
Usage
- Use
[ax-form]
attribute component and assign a formGroup to it. - For each input elements use
axFormControl
. - For action buttons[Submit and Reset] use
axFormButton
and pass a string parameter to it as button type.
Email div class="form-group col-md-6"> Password Sign up Clear
Custom form decorator
Also you can use Axiom custom form decorator @AxForm
for every components you want and generate formGroups.
When use @AxForm
decorator it create a new property for component class as axForms
with type { [key: string]: FormGroup; }
, so you can access each generated formGroups with this.axForms['your form name']
.
for better usage please implements AxForm
interface in your component class.
Here is an example of decorator usage.
@Input() Params
Name | Type | Usage |
---|---|---|
axAutoDisableSubmit | boolean | auto disable submit button when form is invalid |
axShowErrors | boolean | show form errors as a list |