-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathvalidator-functions.component.ts
28 lines (23 loc) · 1.05 KB
/
validator-functions.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Component, OnInit } from '@angular/core';
import {FormControl, FormGroup} from '@angular/forms';
import {persianLettersValidator, persianNumbersValidator} from 'ngx-persian';
@Component({
selector: 'app-validator-functions',
templateUrl: './validator-functions.component.html',
styleUrls: ['../pipes-test/pipes-test.component.css']
})
export class ValidatorFunctionsComponent implements OnInit {
fGroup: FormGroup;
constructor() {
this.fGroup = new FormGroup({
onlyPersianNumbers: new FormControl('', [persianNumbersValidator()]),
onlyPersianLetters: new FormControl('', [persianLettersValidator()]),
persianLettersWithWhiteSpace: new FormControl('', persianLettersValidator({whitespaces: true})),
persianLettersWithEnglishNums: new FormControl('', persianLettersValidator({enDigits: true})),
persianLettersWithPersianNums: new FormControl('', persianLettersValidator({persianDigits: true})),
persianLettersWithSymbols: new FormControl('', persianLettersValidator({symbols: true})),
});
}
ngOnInit() {
}
}