From 2f77a4ff2b4727651990affefecd229a45732fd6 Mon Sep 17 00:00:00 2001 From: Artem Tyurin Date: Wed, 28 Aug 2013 18:01:58 +0400 Subject: [PATCH] fix(form): fix submit prevention Do not prevent submit when action attribute equals to an empty string. Closes #3370 --- src/ng/directive/form.js | 2 +- test/ng/directive/ngEventDirsSpec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index a348babf1af2..ed9172b87f69 100644 --- a/src/ng/directive/form.js +++ b/src/ng/directive/form.js @@ -307,7 +307,7 @@ var formDirectiveFactory = function(isNgForm) { compile: function() { return { pre: function(scope, formElement, attr, controller) { - if (!attr.action) { + if (!attr.action && attr.action !== '') { // we can't use jq events because if a form is destroyed during submission the default // action is not prevented. see #1238 // diff --git a/test/ng/directive/ngEventDirsSpec.js b/test/ng/directive/ngEventDirsSpec.js index 5b73c2dd6a8b..de9410a1de44 100644 --- a/test/ng/directive/ngEventDirsSpec.js +++ b/test/ng/directive/ngEventDirsSpec.js @@ -12,7 +12,7 @@ describe('event directives', function() { describe('ngSubmit', function() { it('should get called on form submit', inject(function($rootScope, $compile) { - element = $compile('
' + + element = $compile('' + '' + '
')($rootScope); $rootScope.$digest(); @@ -29,7 +29,7 @@ describe('event directives', function() { } }; - element = $compile('
' + + element = $compile('' + '' + '
')($rootScope); $rootScope.$digest();