Created
July 23, 2016 15:41
-
-
Save kamikaz1k/d68b001a226d51f598f5f19d9563ab9a to your computer and use it in GitHub Desktop.
Phone Number Component Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-form="phoneNumberForm"> | |
<span ng-if="countryCode === 'CA' || countryCode === 'US'"> | |
<span>+</span> | |
<input type="text" | |
ng-model="phone.countryCode" | |
ng-disabled="true"> | |
<span>(</span> | |
<input type="text" | |
ng-model="phone.areaCode" | |
ng-pattern="/^[0-9]{3}$/" | |
ng-required="required" | |
ng-change="validateInput('area')"> | |
<span>)</span> | |
<input type="text" | |
id="phoneOne" | |
ng-model="phone.phoneOne" | |
ng-pattern="/^[0-9]{3}$/" | |
ng-required="required" | |
ng-change="validateInput('one')"> | |
<span>-</span> | |
<input type="text" | |
id="phoneTwo" | |
ng-model="phone.phoneTwo" | |
ng-pattern="/^[0-9]{4}$/" | |
ng-required="required" | |
ng-change="validateInput()"> | |
</span> | |
<span ng-if="countryCode !== 'CA' && countryCode !== 'US'"> | |
<input type="text" | |
ng-model="phone.international" | |
ng-pattern="/^[0-9]+$/" | |
ng-required="required" | |
ng-change="validateInput()"> | |
</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment