Skip to content

Commit

Permalink
Merge pull request #294 from pasevin/master
Browse files Browse the repository at this point in the history
Fixes #293
  • Loading branch information
pasevin authored Jun 19, 2020
2 parents 118a9f2 + 0a85777 commit 6eda795
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion projects/ngx-intl-tel-input/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-intl-tel-input",
"version": "2.4.1",
"version": "2.4.2",
"peerDependencies": {
"@angular/common": "8.x - 9.x",
"@angular/core": "8.x - 9.x",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ https://stackoverflow.com/a/54075119/1617590
*/
@Directive({
// tslint:disable-next-line: directive-selector
selector: '[formControlName]',
selector: '[ngModel], [formControl], [formControlName]',
})
export class NativeElementInjectorDirective implements OnInit {
constructor(private el: ElementRef, private control: NgControl) {}

constructor(
private controlDir: NgControl,
private host: ElementRef<HTMLFormElement>
) {}
ngOnInit() {
(this.control.control as any).nativeElement = this.el.nativeElement;
if (this.controlDir.control) {
this.controlDir.control['nativeElement'] = this.host.nativeElement;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const phoneNumberValidator = (control: any) => {
}
// Find <input> inside injected nativeElement and get its "id".
const el: HTMLElement = control.nativeElement as HTMLElement;
const inputBox: HTMLInputElement = el.querySelector('input[type="tel"]');
const inputBox: HTMLInputElement = el
? el.querySelector('input[type="tel"]')
: undefined;
if (inputBox) {
const id = inputBox.id;
const isCheckValidation = inputBox.getAttribute('validation');
Expand Down

0 comments on commit 6eda795

Please sign in to comment.