aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AngularPublic.js2
-rw-r--r--src/directive/form.js53
2 files changed, 28 insertions, 27 deletions
diff --git a/src/AngularPublic.js b/src/AngularPublic.js
index d0a0e045..c922c5e2 100644
--- a/src/AngularPublic.js
+++ b/src/AngularPublic.js
@@ -80,7 +80,7 @@ function publishExternalAPI(angular){
ngClassOdd: ngClassOddDirective,
ngCloak: ngCloakDirective,
ngController: ngControllerDirective,
- ngForm: formDirective,
+ ngForm: ngFormDirective,
ngHide: ngHideDirective,
ngInclude: ngIncludeDirective,
ngInit: ngInitDirective,
diff --git a/src/directive/form.js b/src/directive/form.js
index 47274589..f4c96455 100644
--- a/src/directive/form.js
+++ b/src/directive/form.js
@@ -222,31 +222,32 @@ function FormController(name, element, attrs) {
</doc:scenario>
</doc:example>
*/
-var formDirective = [function() {
- return {
- name: 'form',
- restrict: 'E',
- inject: {
- name: 'accessor'
- },
- controller: FormController,
- compile: function() {
- return {
- pre: function(scope, formElement, attr, controller) {
- formElement.bind('submit', function(event) {
- if (!attr.action) event.preventDefault();
- });
+var formDirectiveDev = {
+ name: 'form',
+ restrict: 'E',
+ inject: {
+ name: 'accessor'
+ },
+ controller: FormController,
+ compile: function() {
+ return {
+ pre: function(scope, formElement, attr, controller) {
+ formElement.bind('submit', function(event) {
+ if (!attr.action) event.preventDefault();
+ });
- var parentFormCtrl = formElement.parent().inheritedData('$formController');
- if (parentFormCtrl) {
- formElement.bind('$destroy', function() {
- parentFormCtrl.$removeControl(controller);
- if (attr.name) delete scope[attr.name];
- extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
- });
- }
+ var parentFormCtrl = formElement.parent().inheritedData('$formController');
+ if (parentFormCtrl) {
+ formElement.bind('$destroy', function() {
+ parentFormCtrl.$removeControl(controller);
+ if (attr.name) delete scope[attr.name];
+ extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+ });
}
- };
- }
- };
-}];
+ }
+ };
+ }
+};
+
+var formDirective = valueFn(formDirectiveDev);
+var ngFormDirective = valueFn(extend(copy(formDirectiveDev), {restrict:'EAC'}));