phone-check-egypt
Version:
its a directive that gibe validation on mobile number using regex format .. # directive requirements :
38 lines (29 loc) • 1 kB
Markdown
# what is it
its a directive that gibe validation on mobile number using regex format ..
# directive requirements :
1-angular 4+
2-bootstrap 4
You need to import module ..
```
import {OnlyNumberDirective} from 'phone-check-egypt';
declarations: [
AppComponent,OnlyNumberDirective
]
```
and then you only need to
* give the form name and the reference ..
```
<form #f="ngForm" (ngSubmit)="save()" >
```
* add max length of the mobile number and the directive name ..
```
<input type="text" OnlyNumber max="11" [formData]="f" class="form-control" name="phone" required>
```
# Why to use this package
* you don't need to put validation on mobile number
# Input Attributes
| Attribute | required |
| ------------- |:-------------:|
| required | optional |
| max | Required (to get the the length of the mobile number) |
|[formData] | give the form refrence to make the form invalid |