assisrafael / angular-input-masks

Opinionated input masks for AngularJS
http://assisrafael.github.io/angular-input-masks/
MIT License
963 stars 329 forks source link

ui-br-cpf-mask sets model to undefined #328

Open renanpvaz opened 6 years ago

renanpvaz commented 6 years ago

I tested it and the other masks seem to work, but the CPF one has something wrong with it. I'm using the 2.6.0 version, which is the latest I found for bower (yes unfortunately I'm using it).

This is how I tried using it (the input is wrapped by a form inside a component's template):

<input
  type="text"
  name="cpf"
  class="form-control"
  placeholder="Digite seu CPF *"
  ng-model="$ctrl.verification.cpf"
  ui-br-cpf-mask
  required
/>

I found, however, a small workaround that has weird behavior sometimes:

<input
  type="text"
  name="cpf"
  class="form-control"
  placeholder="Digite seu CPF *"
  ng-model="$ctrl.verification.cpf"
  ui-br-cpfcnpj-mask
  maxlength="14"
  required
/>

If this has been fixed already, publishing the updated version to bower would really help me out!

guicercal commented 6 years ago

i have the same issue here, both for cpf and cnpj masks!! :s

guicercal commented 6 years ago

hey, i found the reason!!! check if the number of cpf is correct!! i tried to use 999.999.999-99 and the mask return undefined, when i put my own cpf number (valid number) the mask return the correct cpf!!

matheusnicolas commented 6 years ago

I'm having this problem too

marcoshmendes commented 4 years ago

Add this to field and the validation will be disabled, all values will be accepted

ng-model-options="{ allowInvalid: true }"