Errors without name in AngularJS form -


i'm trying disable button if form in in isn't valid. however, reason $error array associated form holding list of ten useless errors (so button off), following shape:

{     "$validators": {},     "$asyncvalidators": {},     "$parsers": [],     "$formatters": [         null     ],     "$viewchangelisteners": [],     "$untouched": true,     "$touched": false,     "$pristine": true,     "$dirty": false,     "$valid": false,     "$invalid": true,     "$error": {         "required": true     },     "$name": "",     "$options": null } 

as can see, empty $name property, , no other helpful information.

i've found solution, although not posted problem. issue was using ngif hide parts of form, containing inputs, intentionally. @ point magic idea of changing ngshow came mind, , didn't realize consequences until time after. there problem, angular considers hidden elements not non-existing ones form validation. sounds logic , reasonable.

but, first time started debug form properties in application, , have no idea why $name's empty. i'm using "controller as" syntax instead of attaching stuff $scope? maybe because of this, anyway think downside of angular somehow.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -