@su-lab-28/ng-form-error
v0.0.5
Published
This library was generated with [Nx](https://nx.dev).
Readme
ng-form-error
This library was generated with Nx.
Intorduction
This Angular library simplify the show proscess for errors.
Use
ts component
... --others imports
import { FormBuilder, Validators } from '@angular/forms';
import { FormErrorComponent } from '@su-lab-28/ng-form-error';
@Component({
selector: 'lib-form-element',
imports: [
...
FormErrorComponent
],
})
export class someoneComponent{
_fb$:FormBuilder = inject(FormBuilder);
form = this._fb$.group(
{
text:[null, Validators.required]
}
);
}html
<input type="text" formControlName="text">
<lib-form-error [control]="form.controls['text']"/>The display messages can be updated by setting the values in the localStorage item "form_validation". ts
const messages = {
"required": "Value required",
"minlength": "Minleng required",
"maxlength": "maxleng required",
"min": "No min required",
"max": "Max required",
"email": "No email",
"mustMatch": "No match",
"invalidNumber": "No number",
"pattern": "Strucuture no valid",
"confirmedValidator": "No confirmed"
}
localStorage.setItem('form_validation', JSON.stringify(messages));