Share the post "Form Undefined In Bootstrap Modal Dialog Under Angular JS"
So when I was using Angular JS, I wanted to set the form in a modal dialog window back to its pristine state whenever it was shown.
Problem was, the form is always undefined. If I place a code within the modal window, the form exists but when I call it in a Javascript function, it is undefined.
The solution is to add $parent to your form name like this:
|
1 |
<form name="$parent.myForm"> ... |
This will automatically create the form object in your parent controller. Then, you can simply access it using the scope like $scope.myForm.