Angular 2 RUT
Angular 2 library with several components to handle Chilean RUT validation, cleaning and formatting.
Installation
yarn add ng2-rut# or npm install ng2-rut --save
Usage
Set-up:
The easiest way to use this library is to import Ng2Rut in your app's main module.
;;;
See ./demo
folder for a fully working example.
Using it:
ng2-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 thevalidateRut
directive (to attach to models or inputs) and the RutValidator class to be used asValidator
on reactive forms.RutPipe
: Exposes theRutPipe
pipe to format rut numbers on templatesRutDirective
: Exposes theformatRut
directive to format RUT inputs.
RutValidator
Reactive forms
;
Template Form
RutPipe
{{ user.rut }}<!-- 30972198 -->{{ user.rut | rut }}<!-- 3.097.219-8 -->
formatRut (Directive)
<!--(on blur)3.097.219-8 (on focus)30972198-->
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Credits
Thank you contributors!
ng2-rut is maintained by platanus.
License
Angular 2 RUT is © 2016 Platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.