指令以格式电话号码 [英] A directive to format phone number

本文介绍了指令以格式电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用angularjs指令自动设置在输入字段是多少?当我在输入栏中键入说6042919283我希望它显示为604-291-9283。

I was wondering how to automatically format a number in an input field using an angularjs directive? When I type in an input field say 6042919283 I want it to be shown as 604-291-9283.

感谢

推荐答案

您可以使用 UI utils的面具
它允许你定义一个allowd输入格式,将处理验证你以及格式化

You could use UI Utils mask It allows you to define an allowd input format and will handle the validation for you as well as the formatting

这篇关于指令以格式电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆