Andrey Unger2014-04-13 18:55:05
Andrey Unger, 2014-04-13 18:55:05

AngularJS && jQuery maskedinput?

Tell me how to make friends of subjects? Found something like this on the internet:

.directive('inputMask', ['$document', function($document) {
        return {
            link: function(scope, elm, attrs) {
                    elm.mask("+7(999)999-9999? +9999");
                    elm.attr("placeholder", "+79201234567890");

Works, but. I have a select opposite the input with the type of contact: phone, email, etc. Therefore, when changing in the select, you need to change the input mask. It just works on the jeckery if you hang it on the onchange. How to do it for Angular? At the same time, during initialization, pull out what values ​​are there in the select and hang up the appropriate mask. And yes, blocks with select and input are generated by ng-repeat - that is, there are a lot of them.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Andrey K, 2014-04-13


Mikhail Osher, 2014-04-14

Hang a watcher on the value of the select, and depending on it, apply the desired mask.
// upd
Something like this. :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question