Reputation: 31
<ngx-mat-intl-tel-input [preferredCountries]="['in', 'us', 'gb' ]" [enableSearch]="true" [enablePlaceholder]="true"
#phoneNumber="ngModel" [(ngModel)]="Sms" name = "Sms" required>
</ngx-mat-intl-tel-input>
On submit of the form i am not able to clear the ngx mat intl tel input , other input fields are cleared except the tele phone field.
Upvotes: 2
Views: 1436
Reputation: 31
You could try manually clearing the input. E.g.:
@ViewChild(NgxMatIntlTelInputComponent, {static: true}) phoneInput: NgxMatIntlTelInputComponent;
And then something like:
if (this.phoneInput) {
const telInput = document.querySelector(`#${this.phoneInput.id} input[type="tel"]`);
if (telInput) {
(<any>telInput).value = '';
}
}
Upvotes: 0
Reputation: 414
Try this
.TS File
@ViewChild('phoneNumber') phone: FormControl`
yourResetMethod(){
this.phone.reset();
}
Upvotes: 0