How to use jQuery Mask Plugin with ion-input?

I need to set text masks in ion-inputs. The reason for the use of this mask library in specific is the fact that I need good control of input cursor and this library to it.

How to use jQuery Mask Plugin with ion-input?

I think this is a mistake. If you can’t find an Angular solution off the shelf, you can always use split two-way binding.

1 Like

Sorry, but I don’t understood your answer.

I’m not just talking about data binding in a input, but also over input’s cursor control. When I change programmatically the value binded to an input the cursor tend’s to keep the same position, which is not the expected behavior. It’s, of course, just one of the complexities of cursor handling in masked inputs.

The point @rapropos is making is that you shouldn’t try and combine jQuery with Angular like your trying now. Aren’t there any Angular solutions out there that can solve your problem?

[quote=“luukschoen, post:4, topic:99526”]
The point @rapropos is making is that you shouldn’t try and combine jQuery with Angular like your trying now. Aren’t there any Angular solutions out there that can solve your problem?[/quote]

I could not find a good solution for Angular 4 that works well with Ionic 3.

I already combinated Angular 2 and jQuery with sucess. Later I will post the solution.

I thought the reason to not combine Angular and jQuery was the fact that jQuery handles DOM directly and handle DOM directly was not recommended by Angular’s engineers in older versions of the framework due performance reasons.

Yes and jQuery’s paradigm therefore not really fits with that of Angular. It’s not about if it’s possible or not, more a question do you really want to combine those two techniques?

I would prefer to not combine. In fact, during many time I tried to avoided jQuery, but was I not found a good input mask library compatible with Ionic 3 and it’s too hard to create one I decided to use jQuery.