File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ var componentAsDirective = ['$parse', function($parse) {
51
51
var controllerName = tAttrs . $normalize ( tElement [ 0 ] . tagName . toLowerCase ( ) )
52
52
. replace ( / [ ^ \w ] \w / g, function ( a ) { return a . slice ( 1 ) . toUpperCase ( ) ; } ) ;
53
53
54
+ // special case: ngForm is the only known directive that uses an undocumented
55
+ // feature of .directive able to change the name of the directive
56
+ if ( controllerName === 'ngForm' ) {
57
+ controllerName = 'form' ;
58
+ }
59
+
54
60
// get the setter for the as attribute
55
61
var setter = $parse ( tAttrs . as ) . assign ;
56
62
Original file line number Diff line number Diff line change @@ -124,4 +124,10 @@ describe('as', function() {
124
124
expect ( $rootScope . $ctrl . form . $valid ) . toBe ( true ) ;
125
125
} ) ) ;
126
126
127
+ it ( 'should be compatible with ngForm' , inject ( function ( $compile , $rootScope ) {
128
+ $rootScope . $ctrl = { } ;
129
+ $compile ( '<ng-form as="$ctrl.form"></ng-form>' ) ( $rootScope ) ;
130
+ expect ( $rootScope . $ctrl . form . $valid ) . toBe ( true ) ;
131
+ } ) ) ;
132
+
127
133
} ) ;
You can’t perform that action at this time.
0 commit comments