jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 293 forks source link

djngError directive causes errors in angular>=1.3.0 #193

Closed potpath closed 8 years ago

potpath commented 9 years ago

The parser removes $error.bound but causes $error.parse instead. I think the reason is angular1.3.0-rc.4 changes how $parsers is registered (See https://github.com/angular/angular.js/blob/master/CHANGELOG.md#bug-fixes-37). My fix is to always return value.

Also, bounded field value may not be an empty string, e.g., unique constraint violation. My fix is to remove $error.bound only if new value does not equal to old value.

jrief commented 9 years ago

I use django-angular with angularjs-1.3.7 and it works perfectly. Could you please try with that version. Currently I don't see any need for changing the code.

potpath commented 9 years ago

This bug happens when server-side validation of some input failed, and there is a djng-error="bound-field" attribute on the corresponding input.

I've created a demo using the same code as the example site except using angular1.3.7 instead of angular1.2.28, here.

Steps to reproduce the bug are,

  1. Press 'Force Form Submission' button
  2. Type in 'First name' field.

You can see that the field validation is always invalid. I think this bug is caused by the parser function pushed by djngError directive, as I said above.