Skip to content

Commit b934542

Browse files
committed
Code cleanup; Added instructions for usage
1 parent 54e6dec commit b934542

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,33 @@ Angular2 CC Library - for validation and formating of input parameters
1010

1111
# Usage
1212

13+
## Installation
14+
```shell
15+
npm install ng2-cc-library --save
16+
```
17+
18+
1319
## Formating Directive
1420
On the input fields, add the specific directive to format inputs.
1521
All fields must be `type='tel'` in order to support spacing and additional characters
1622

23+
```javascript
24+
import { NgModule } from '@angular/core';
25+
import { BrowserModule } from '@angular/platform-browser';
26+
import { FormsModule } from '@angular/forms';
27+
import { CreditCardDirectivesModule } from 'ng2-cc-library'
28+
29+
import { AppComponent } from './app.component';
30+
31+
@NgModule({
32+
imports: [BrowserModule, FormsModule, CreditCardDirectivesModule],
33+
declarations: [AppComponent],
34+
bootstrap: [AppComponent]
35+
})
36+
export class AppModule {
37+
}
38+
```
39+
1740
**Credit Card Formater**
1841
* add `ccNumber` directive:
1942
```html
@@ -36,25 +59,9 @@ Will support format of MM/YY or MM/YYYY
3659
### Validation
3760
Current only Model Validation is supported.
3861
To implement, import the validator library and apply the specific validator on each form control
39-
```javascript
40-
import { NgModule } from '@angular/core';
41-
import { BrowserModule } from '@angular/platform-browser';
42-
import { FormsModule } from '@angular/forms';
43-
import { CreditCardDirectivesModule } from 'ng2-cc-library'
44-
45-
import { AppComponent } from './app.component';
46-
47-
@NgModule({
48-
imports: [BrowserModule, FormsModule, CreditCardDirectivesModule],
49-
declarations: [AppComponent],
50-
bootstrap: [AppComponent]
51-
})
52-
export class AppModule {
53-
}
54-
```
5562

5663
```javascript
57-
import { CreditCardValidator } from '../../src/validators/credit-card.validator';
64+
import { CreditCardValidator } from 'ng2-cc-library';
5865

5966
@Component({
6067
selector: 'app',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng2-cc-library",
3-
"version": "0.0.7",
3+
"version": "1.0.0",
44
"description": "angular2 credit card library",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/directives/expiry-format.directive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export class ExpirayFormatDirective {
1414
}
1515

1616
@HostListener('keypress', ['$event']) onKeypress(e) {
17-
console.log(CreditCard.restrictExpiry(e.which, this.target));
1817
if (CreditCard.restrictNumeric(e) && CreditCard.restrictExpiry(e.which, this.target)) {
1918
this.formatExpiry(e);
2019
this.formatForwardSlashAndSpace(e);

0 commit comments

Comments
 (0)