angular-ui / ui-mask

Mask on an input field so the user can only type pre-determined pattern
https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html
MIT License
391 stars 257 forks source link

Error on click and keyup events #175

Closed ermolaevalexey closed 8 years ago

ermolaevalexey commented 8 years ago

I finally provided the mask, but here's the problem: when the field gets focused, i get a TypeError in console: Uncaught TypeError: Cannot read property 'toString' of undefined. Is this about empty ng-model, when field is empty of something else? The data from input is handled by formController, which creates an empty object and adds properties from <form> to it. Because of this TypeError, I can't implement client validation of 'phone' field, cause there's no value at all, when mask is on. But if i fill the input, it transfers to object without any problems. How can I resolve this problem?

Here's my repo again to watch the project: https://github.com/ermolaevalexey/alfamotors-test-angular

ermolaevalexey commented 8 years ago

please answer someone, it's very imporant