Thursday, 15 September 2011

angularJS valdr + ui-select validation -


I was messed up on this issue but still I could not find the right discussion about it. We are using Vallar and UI in a form (angularjs app) and we have encountered this problem that the input of the UI-Selection renderer will not get the name attribute, and since then, angular throws an error:

  Error: The form element with id is not bound to the "undefined" field name. On d.link (http: // localhost: 8080 / bower_components / valdr / valdr.min.js: 1: 8414) at invokeLinkFn (http: // localhost: 8080 / bower_components / angular / Angular.js: 8141: 9) On nodeLinkFn (http: // localhost: 8080 / bower_components / angular / Angular.js: 7653: 11) at compositeLinkFn (http: // localhost: 8080 / bower_components / angular / angular.js: 7009: 13) at nodeLinkFn (http : // local host: 8080 / bower_components / angular / Angular.js: 7648: 24) at http: // local host: 8080 / bower_components / angular / Angular.js: 7884: processQueue 13 (http: // localhost: 8080 / Bower_components / angular / Angular.js: 13071: 27) at http: // local host: 8080 / bower_components / angular / Angular.js: 13087: .. $ 27 get.Scope $ eval ($ http: // localhost: 8080 /bower_components/angular/angular.js:14287:28) at scope $ get.scope $ digest (http: // localhost: 8080 / bower_components / angular / Angular.js: 14103: .. 31) K & lt; Input type = "autocomplete =" off "tabindex =" - 1 "aria-expanded =" true "aria-label =" {{$ select.baseTitle}} "aria-owns =" ​​UI-Selection-Option - {{$ Select select.Create IID}} "Area -activedescendant =" ui-Selection-Options Line - {{$ select.generatedId}} - {{$ select.activeIndex}} "class =" Form Control ui-Selection- Search ng-ancient ng-insulated nG-valid "placeholder =" {{$ select.placeholder}} "ng-model =" $ select.search "ng-show =" $ select.search enabled & amp; amp; $ Select.open "& gt;  

So we tried some hacks on the UI-Selection Directive, like template catches, hidden information with the same model, but the result is the same.

BTW template catches rewriting is the worst method of this instruction used for use by other reasons for this instruction and we can not hack the whole app.

Was anyone experiencing this problem?

Code snippet:

If Name attribute input element valdr throws an exception but does not exist.

ui-select internally creates an input field without name > error. Therefore error

You can try to get rid of the error. return (function) (return to 'e', ​​compile): function () {return} {return: (function, field, element, Etters) {// If the input is made by Ui-select and is the NG-model if (element.hasClass ('UI-Selection-Search') & amp; amp; Attrs.ngModel) {if (! Attrs.name ) {// If there is no name in the input attrs.name = 'ui-select' + (++ count); // Assign name}}}}}}})


No comments:

Post a Comment