angular.js
angular.js copied to clipboard
Parent Form not able to evaluate dynamically generated nested forms
I have created a parent form, and within it created dynamically generated nested forms using a directive.
The parentForm.$error object is able to evaluate errors that are immediately within the form and even within a nested form; however, the parentForm.$error does not see any of the errors that are generated for DYNAMICALLY GENERATED nested forms.
I've created a plunker to demonstrate:
http://plnkr.co/edit/zgQkSzpc9Qcvtm26nlSv?p=preview
There are a few issues here:
- The new form element is not compiled, so the form is never known to the parent
- The child form must be in the DOM to be able to find the parent form
- replaceWith seems to do something strange here, as the element inside the link function is still the div, and compiling it fails as it is not in the DOM, and even if you simply append it to the element, and compile it, it still is not in the parent form
I've closed this due to lack of response. Feel free to reopen with more information.