Skip to content

Commit

Permalink
feat(public-api): export custom validator
Browse files Browse the repository at this point in the history
  • Loading branch information
rbalet committed Oct 13, 2024
1 parent d8dbf00 commit 4004661
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mat-input-tel",
"version": "18.4.0",
"version": "18.5.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-mat-input-tel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mat-input-tel",
"version": "18.4.0",
"version": "18.5.0",
"author": {
"name": "Raphaël Balet",
"email": "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { Subject } from 'rxjs'
import { CountryCode, Examples } from './data/country-code'
import { Country } from './model/country.model'
import { PhoneNumberFormat } from './model/phone-number-format.model'
import { phoneNumberValidator } from './ngx-mat-input-tel.validator'
import { ngxMatInputTelValidator } from './ngx-mat-input-tel.validator'
import { SearchPipe } from './search.pipe'

class ngxMatInputTelBase {
Expand All @@ -75,7 +75,7 @@ const _ngxMatInputTelMixinBase: typeof ngxMatInputTelBase = mixinErrorState(
{ provide: MatFormFieldControl, useExisting: NgxMatInputTelComponent },
{
provide: NG_VALIDATORS,
useValue: phoneNumberValidator,
useValue: ngxMatInputTelValidator,
multi: true,
},
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FormControl } from '@angular/forms'
import { parsePhoneNumber, PhoneNumber } from 'libphonenumber-js'

export const phoneNumberValidator = (control: FormControl) => {
export const ngxMatInputTelValidator = (control: FormControl) => {
const error = { validatePhoneNumber: true }
let numberInstance: PhoneNumber

Expand Down
1 change: 1 addition & 0 deletions projects/ngx-mat-input-tel/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*/

export * from './lib/ngx-mat-input-tel.component'
export * from './lib/ngx-mat-input-tel.validator'

0 comments on commit 4004661

Please sign in to comment.