Polymer Gold Phone Input
The Polymer gold-phone-input element is a simple text field, used to specify phone number. It is styled in Material Design.
Syntax:
Validation
To validate a phone number, use the pattern XXX-XXXXXXX, where “X” is a digit and “-” is a separator. By default, this specifies a US phone number. To use different number patterns, use the attributes country-code and phone-number-pattern like this:
The validate() method is used to validate phone number manually. It returns true if it is valid otherwise false, if it is not valid. You can use auto-validate and required attributes to make the input to be automatically validated.
Example
Run the following command to install gold-phone-input element in your project directory. After that you can use this element in your application:
It will install all the related elements of polymer_gold-phone-input under the bower_components folder.
Create an index.html file and add the following code in it to see the usage of gold-phone-input element in Polymer.js.
Output: