Angular 10 RUT =============
npm install ng10-rutAngular 10 RUT
=============
 
Forked from https://github.com/landscapedotcl/ng9-rut to work with Angular 10.
Angular 10 library with several components to handle Chilean RUT validation, cleaning and formatting.
``bash`
yarn add ng10-rutor
npm install ng10-rut --save
The easiest way to use this library is to import Ng10Rut in your app's main module.
`typescript
import { NgModule } from '@angular/core';
import { Ng10RutModule } from 'ng10-rut';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
...
imports: [
BrowserModule,
Ng10RutModule
],
})
class DemoAppModule { }
`
ng10-rut exposes multiple features that can be used to perform input validation and formatting. Probably you want to use one of the following:
- RutValidator: Exposes the validateRut directive (to attach to models or inputs) and the RutValidator class to be used as Validator on reactive forms.RutPipe
- : Exposes the RutPipe pipe to format rut numbers on templatesRutDirective
- : Exposes the formatRut directive to format RUT inputs.
#### RutValidator
##### Reactive forms
`typescript
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
import { RutValidator } from 'ng10-rut';
export class DemoAppComponent {
constructor (fb: FormBuilder, rutValidator: RutValidator) {
this.reactiveForm = fb.group({
rut: ['30972198', [Validators.required, rutValidator]]
});
}
}
`
##### Template Form
`html`
#### RutPipe
`html`
{{ user.rut }}
{{ user.rut | rut }}
#### formatRut (Directive)
`html`
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)git commit -am 'Add some feature'
3. Commit your changes ()git push origin my-new-feature`)
4. Push to the branch (
5. Create new Pull Request
The original lib was created based on Platanus lib:
https://github.com/platanus/ng2-rut
Angular 2 RUT is © 2016 Platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.