July 2017
Intermediate to advanced
384 pages
8h 23m
English
Till now, all the examples of input masks have shown that all the characters in a mask are mandatory. It is also possible that you can make a part of the mask optional with the use of the question mark (?) character. Anything listed after the question mark within a mask definition will be treated as an optional input. A common use case is displaying the phone number with an optional extension number, as follows:
<span>Phone Ext</span><p-inputMask mask="(999) 999-9999? x99999" [(ngModel)]="optional" name="optionalmask" placeholder="(999) 999-9999? x99999"></p-inputMask>
Once the user finishes the input by reaching the question mark character and blurs the component, the rest of the validation will be skipped. ...
Read now
Unlock full access