angular-ui-form-validation icon indicating copy to clipboard operation
angular-ui-form-validation copied to clipboard

Custom templates don't work properly

Open csaftoiu opened this issue 9 years ago • 3 comments

See the branch I made, https://github.com/csaftoiu/angular-ui-form-validation/tree/fix-custom-template . On the demo, I changed /views/errorTemplateOne.html to:

<div>ab <small class="error" >a - {{errorMessage}} - b</small> bc</div>

However, when validation fails on a minlength error (with validation-min-length="{template:'/views/errorTemplateOne.html', value:6}"), it just shows the error message, without any of the <div> or <small> that I added.

csaftoiu avatar Nov 06 '15 16:11 csaftoiu

An update: If instead the template is:

<small class="error"></small>

Then I find the following behavior:

  • If I type fe, then tab away, the error shows without the small.
  • If I then click back, and type another character, the error shows with the small.

Something is wonky with the logic here.

csaftoiu avatar Nov 06 '15 16:11 csaftoiu

Another update, the initial bug I found. If I have

validation-max-length="{template:'/views/errorTemplateOne.html', value:10}"

Using that same <small class="error"></small> template, then on the 11th character it shows the proper error message, but if I type more characters it shows "Maximum of undefined characters", and the error message persists.

csaftoiu avatar Nov 06 '15 17:11 csaftoiu

ok nice catch, working on this now

nelsonomuto avatar Nov 16 '15 16:11 nelsonomuto