简体   繁体   中英

AngularJS Formly ui-mask: Removing input mask characters for model

I have an input mask set up on a 10-digit phone number field in my Formly form using AngularJS: just masking the input with dashes: xxx-xxx-xxxx. The dashes are correctly displaying on the page, but the Formly model value for the field retains the dashes. How can I configure the form field to ignore the mask characters (dashes)? The model value should be:

phoneNumber: '4838884747'

not

phoneNumber: '483-888-4747'

I haven't gotten a formatter to work yet. Help, please?

 var s = "483-888-4747"; var s2 = s.split("-").join(''); console.log(s2); 

For more information, see

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM