Comments (6)
Hi,
You can pass your FormControl to the telephone input component.
Something like this should be ok:
<ngx-material-intl-tel-input [fieldControl]="addOrgGroupForm.get('phone')"></ngx-material-intl-tel-input>
Let me know if it works.
from ngx-material-intl-tel-input.
Hi,
Thanks for quick reply
its work on form add and i need to know to how to work with on edit time so that patch this value
get phoneControl(): FormControl {
return this.addOrgGroupForm.get('phone') as FormControl;
}
----html----
<ngx-material-intl-tel-input
[fieldControl]="phoneControl">
</ngx-material-intl-tel-input>
```
submitForm() {
console.log(this.addOrgGroupForm.value);
//
phone: "+91 80900 00120"
}
now please guide me how to patch this value in phone
our init form is
``` this.addOrgGroupForm = this.fb.group({
id: [0],
description: ['', [Validators.required]],
name: ['', [Validators.required]],
email: ['', [Validators.required]],
phone: ['+91 80900 00120', [Validators.required]],
});
} ```
from ngx-material-intl-tel-input.
This is working for me:
addOrgGroupForm: FormGroup = this.fb.group({
id: [0],
description: ['', [Validators.required]],
name: ['', [Validators.required]],
email: ['', [Validators.required]],
phone: [''],
});
get phoneControl(): FormControl {
return this.addOrgGroupForm.get('phone') as FormControl;
}
If the input is required and you need to set an initial value your HTML should look like this:
<ngx-material-intl-tel-input
[fieldControl]="phoneControl"
[initialValue]="'+91 80900 00120'"
[required]="true"
>
</ngx-material-intl-tel-input>
from ngx-material-intl-tel-input.
Hi,
how i can remove textlabel
<ngx-material-intl-tel-input
[fieldControl]="phoneControl"
[initialValue]="'+91 80900 00120'"
[required]="true"
from ngx-material-intl-tel-input.
Just replace textLabels by empty strings:
<ngx-material-intl-tel-input
[fieldControl]="phoneControl"
[initialValue]="'+91 80900 00120'"
[required]="true"
[textLabels]="textLabels"
>
</ngx-material-intl-tel-input>
textLabels = {
mainLabel: '',
codePlaceholder: '',
searchPlaceholderLabel: '',
noEntriesFoundLabel: '',
nationalNumberLabel: '',
hintLabel: '',
invalidNumberError: '',
requiredError: ''
};
from ngx-material-intl-tel-input.
In the latest release(18.0.1) you can use fieldControlName to pass the phone formControlName from your form group.
from ngx-material-intl-tel-input.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-material-intl-tel-input.