angularjs-ng-form

Set AngularJS nested forms to submitted

梦想的初衷 提交于 2019-12-01 04:18:47
I've got a nested AngularJS form like so: <form name="parentForm" ng-submit="submit()"> <input name="parentInput" type="text"> <ng-include src="childForm.html" ng-form="childForm"></ng-include> <button type="submit">Submit</submit> </form> And here's childForm.html <input name="childInput" type="text"> For reasons unrelated to the question, I can't merge the parent and child forms - they need to be two separate files. Now, when the user clicks the submit button, validation is correctly applied to both parentForm and childForm. However, only the parent form has it's $submitted flag set to true,

Validation doesnt work for File Input with 'Required' attribute- AngularJS

≡放荡痞女 提交于 2019-12-01 01:32:26
问题 I have been playing around this and couldnt get it to work. I was creating an angular form and I was able to get the validation to work when required attribute is added to the text field. However, if a input type file is added with required attribution, I noticed that the $error.required text is shown but it doesnt validation even if a file is chosen. Its still showing as invalid even after adding a file. I have created a sample in jsfiddle so you can check this out: http://jsfiddle.net/Alien

Getting form controls from FormController

独自空忆成欢 提交于 2019-11-30 07:56:48
I need a way to loop through the registered controls of an AngularJS form. Essentially, I'm trying to get all the $dirty controls, but there's no array of the controls (the FormController has a number of different properties/functions in addition to containing the controls themselves - each as its' own object). I've been looking at the source code, and I see that there is a controls array in the FormController that is exactly the array I'm looking for. Is there a way to get access to this value, or extend the FormController to include a function that returns this controls array? Edit: Plnkr

Getting form controls from FormController

喜欢而已 提交于 2019-11-29 11:16:36
问题 I need a way to loop through the registered controls of an AngularJS form. Essentially, I'm trying to get all the $dirty controls, but there's no array of the controls (the FormController has a number of different properties/functions in addition to containing the controls themselves - each as its' own object). I've been looking at the source code, and I see that there is a controls array in the FormController that is exactly the array I'm looking for. Is there a way to get access to this

Angular ng-repeat with ng-form, accessing validation in controller

大憨熊 提交于 2019-11-27 19:19:12
I am trying to generate an editable list using ng-repeat . I want to remind the user to update any edits before moving on, so I am using ng-form to create "nested" forms on the fly because the documentation says I can then use validation on these dynamically created inputs. While that seems to work within the HTML, I don't see how to access those dynamically created forms and related validation fields in the controller. Specifically, when the user changes the input I use the form $dirty property to bring up a button to tell the user to commit the changes. So far, so good. However, once the

Angular ng-repeat with ng-form, accessing validation in controller

£可爱£侵袭症+ 提交于 2019-11-26 19:49:31
问题 I am trying to generate an editable list using ng-repeat . I want to remind the user to update any edits before moving on, so I am using ng-form to create "nested" forms on the fly because the documentation says I can then use validation on these dynamically created inputs. While that seems to work within the HTML, I don't see how to access those dynamically created forms and related validation fields in the controller. Specifically, when the user changes the input I use the form $dirty