Coder Social home page Coder Social logo

Comments (6)

juanjotorres90 avatar juanjotorres90 commented on August 14, 2024

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.

abhinaykm avatar abhinaykm commented on August 14, 2024

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.

juanjotorres90 avatar juanjotorres90 commented on August 14, 2024

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.

abhinaykm avatar abhinaykm commented on August 14, 2024

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.

juanjotorres90 avatar juanjotorres90 commented on August 14, 2024

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.

juanjotorres90 avatar juanjotorres90 commented on August 14, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.