@@ -10,10 +10,33 @@ Angular2 CC Library - for validation and formating of input parameters
10
10
11
11
# Usage
12
12
13
+ ## Installation
14
+ ``` shell
15
+ npm install ng2-cc-library --save
16
+ ```
17
+
18
+
13
19
## Formating Directive
14
20
On the input fields, add the specific directive to format inputs.
15
21
All fields must be ` type='tel' ` in order to support spacing and additional characters
16
22
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
+
17
40
** Credit Card Formater**
18
41
* add ` ccNumber ` directive:
19
42
``` html
@@ -36,25 +59,9 @@ Will support format of MM/YY or MM/YYYY
36
59
### Validation
37
60
Current only Model Validation is supported.
38
61
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
- ```
55
62
56
63
``` javascript
57
- import { CreditCardValidator } from ' ../../src/validators/credit-card.validator ' ;
64
+ import { CreditCardValidator } from ' ng2-cc-library ' ;
58
65
59
66
@Component ({
60
67
selector: ' app' ,
0 commit comments