ui-mask icon indicating copy to clipboard operation
ui-mask copied to clipboard

ui mask filter

Open alexgoroshko opened this issue 9 years ago • 13 comments

It would be great to have ui-mask-like filter. Example:

{{1234567899 | mask: '(999) 999-9999'}} // -> (123) 456-7899

alexgoroshko avatar Aug 18 '15 16:08 alexgoroshko

:+1:

chadwhitaker avatar Aug 18 '15 16:08 chadwhitaker

Yeah, totally true. This module sucks without it... Seems quite logical...

ssougnez avatar Sep 09 '15 12:09 ssougnez

+1

arthur-kv avatar Sep 09 '15 12:09 arthur-kv

Just found this: http://stackoverflow.com/questions/20999141/how-do-i-get-masked-date-in-model-from-input-in-angular-using-ui-mask

And it works, so it seems it is included... If only stuff such as notifications existed :-D

ssougnez avatar Sep 09 '15 12:09 ssougnez

Thanks, that helped!

arthur-kv avatar Sep 09 '15 12:09 arthur-kv

PR are welcomed, feel free to improve the demo page.

PowerKiKi avatar Sep 10 '15 01:09 PowerKiKi

+1

ikr0m avatar Sep 28 '15 21:09 ikr0m

This is interesting. The use case is slightly different when you're using it as a filter, right? We wouldn't need to validate, for instance.. And, if we don't need to validate, do we need to define the mask explicitly as containing numbers or letters? For example, what would be the difference in functionality for the following two filters?

AAA-999-*** ***-***-***

For a value of 12A-AB2-A2B... If A or 9 actually affect the output, what would the output look like?

Assuming they don't affect the output, the only applicable maskDefinition is the *. If that's the case, this may be a pretty simple filter to write.

Tim91084 avatar Oct 28 '15 03:10 Tim91084

+1

vinyoliver avatar Nov 25 '15 18:11 vinyoliver

I agree, unfortunately it looks like it would require a huge refactor.

hahn-kev avatar Dec 11 '15 23:12 hahn-kev

Well it's not perfect but it should get you by https://gist.github.com/hahn-kev/b3e74a07b53c26ddee1b

hahn-kev avatar Dec 14 '15 16:12 hahn-kev

@hahn-kev Thank you very much for that code. You really saved my time.

Regards

renatoguarilha avatar Feb 27 '16 11:02 renatoguarilha

+1 much needed feature

kashpatel avatar Dec 13 '17 13:12 kashpatel