File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ function FormController(element, attrs) {
42
42
controls = [ ] ;
43
43
44
44
// init state
45
- form . $name = attrs . name ;
45
+ form . $name = attrs . name || attrs . ngForm ;
46
46
form . $dirty = false ;
47
47
form . $pristine = true ;
48
48
form . $valid = true ;
Original file line number Diff line number Diff line change @@ -63,6 +63,17 @@ describe('form', function() {
63
63
expect ( scope . myForm . alias ) . toBeDefined ( ) ;
64
64
} ) ;
65
65
66
+ it ( 'should use ngForm value as form name when nested inside form' , function ( ) {
67
+ doc = $compile (
68
+ '<form name="myForm">' +
69
+ '<div ng-form="ngForm"><input type="text" name="alias" ng-model="value"/></div>' +
70
+ '</form>' ) ( scope ) ;
71
+
72
+ expect ( scope . myForm ) . toBeDefined ( ) ;
73
+ expect ( scope . myForm . ngForm ) . toBeDefined ( ) ;
74
+ expect ( scope . myForm . ngForm . alias ) . toBeDefined ( ) ;
75
+ } ) ;
76
+
66
77
67
78
it ( 'should publish form to scope when name attr is defined' , function ( ) {
68
79
doc = $compile ( '<form name="myForm"></form>' ) ( scope ) ;
You can’t perform that action at this time.
0 commit comments