candreoliveira / ngMask

Best Angular mask alternative! No jQuery, pure JS. About ~6kb!
http://candreoliveira.github.io/#/ngMask
ISC License
419 stars 171 forks source link

constant number in mask #27

Open perython opened 9 years ago

perython commented 9 years ago

Hey @candreoliveira, thanks for the plugin!

I want to have this kind of mask for phone number: +1 (999) 999-99-99. Here number 1 should be constant 1, just like plus sign.

Is it possible to set constant number in the mask? I haven't found an example of it.

candreoliveira commented 9 years ago

Not yet. But I'm rewriting the mask to improve quality and I'll cover it. Thanks!

LennyLip commented 9 years ago

+1 i need it

drakmail commented 9 years ago

+1 really need it for phone input

resetko commented 9 years ago

+1 need it for country code for phone number ( for example +7 (999) 999-99-99 )

also it would be nice if i can set regexp for some part of mask, for example i need complex check of first part of number - only 910 and 920 ( +7 (910) XXX-XX-XX or +7 (920) XXX-XX-XX )

drakmail commented 9 years ago

As workaround I'm used bootstraps input group addon like this:

<div class="input-group">
  <span class="input-group-addon" id="basic-addon1">+7</span>
  <input type="text" class="form-control" placeholder="(___) ___ __ __"  ng-model="maskModel" mask="(999) 999 99 99">
</div>
LennyLip commented 9 years ago

i think, we need not only constant, it can be list like a: +(7,) +(7,8) +(2,7,8)

etc...

may be result of @candreoliveira rewriting proccess is replaced current mask syntax with "all known" regex syntax?

resetko commented 8 years ago

@candreoliveira hi, is there any progress on this? Maybe someone else should implement this?

drugoi commented 8 years ago

Any progress on this? @candreoliveira

drakmail commented 8 years ago

any progress? @candreoliveira