Angular2 Directive for Cleave.js
npm install angular-cleaveSimple directive to use the excellent Cleave.js library in an Angular2 application.
Import the directive in your application's module
```
npm i -S angular-cleave
Import the directive in your application's module
``
import { CleaveDirective } from 'angular-cleave'
@NgModule({
...
declarations: [
...
CleaveDirective
],
...
})
Use it in your components
`
@Component({
...
template: ''
})
export class LoginComponent {
cleaveOptions = {
numeral: true,
delimiter: '*',
blocks: [1, 2, 3]
}
}
`
You may also pass in directly the options in the HTML
``
To make it easier in simplest use cases, you may also use the following short syntax
``
Available options :
- creditCardphone
- date
- numeral`
-
For the full list of options, check Cleave.js documentation.
If you need to support Phone lib add-ons, throw in an issue. Even better if you know how to had support for these add-ons, submit a PR 😎
Any other feature request, or if the lib doesn't work on your setup please file an issue.