1.0.4 • Published 4 years ago

@numetalsour/rut-material v1.0.4

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

RutMaterial for ReactiveForm Angular

Simple input RUT with MaterialAngular, validations, format & errors

Reference

ParameterDefaultTypeDescription
formParent<FormGroup>Required. parent FormBuilder
label'Ingrese su RUT'stringRequired. text on label
name'rut'stringRequired. unique 'name' of control
value''stringOptional. to set initial value on input
placeholder'12.345.678-9'stringOptional. placeholder on input
disabledfalsebooleanOptional. if control is disabled
readonlyfalsebooleanOptional. if control is readonly
requiredfalsebooleanOptional. if control is required
appearance'outline''fill', 'legacy', 'outline', 'standard'Optional. appearance of 'mat-form-field'
floatLabel'auto''auto', 'always', 'never'Optional. appearance of 'Label'
hintfalsestring, booleanOptional. show mat-hint
classField''stringOptional. set class to add style to 'mat-form-field'
classHint''stringOptional. set class to add style to 'mat-hint'
pastetruebooleanOptional. enable or disabled paste on input
autocompleteon'on', 'off'Optional. if input have autocomplete form
errorRequired'El RUT es requerido'stringOptional. set message to required error
errorInvalid'El Rut es inválido'stringOptional. set message to Invalid error
errorCustomfalsestring, booleanOptional. set message to custom error

Installation

  ng add @angular/material
  npm i @numetalsour/rut-material
  
  add "RutMaterialModule" to your "imports" in x.module.ts 
  add "FormsModule" to your "imports" in x.module.ts

  Check styles.x if you have
  @import "~@angular/material/prebuilt-themes/indigo-pink.css"
  or another

HTML:

<form (ngSubmit)="onSubmint()">
<rut-material
    [name]="'rut_empresa'"
    [value]="'12.345.678-9'"
    [label]="'Ingrese su RUT'"
    [formParent]="formExample"
    [required]="true"
></rut-material>

<button type="submit">click!</button>
</form>

Component:

formExample: FormGroup

constructor(private fb: FormBuilder) {
    this.formExample = this.fb.group({
        rut_empresa: ['', []],
    })