opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

ng-submit does not prevent jquery mobiles form submit handling #92

Closed JohannesRudolph closed 11 years ago

JohannesRudolph commented 11 years ago

Jquery mobile collides in a very unfortunate manner with angular.js when handling forms.

The following fiddle demonstrates that angular does not successfully prevent jqm from loading the next page when ajax is not disabled. It only successfully prevents the browsers default action with event.preventdefault().

http://jsfiddle.net/FHVMh/11

Any way to get jqm out of the way? I tried disabling ajax on the form by specifying data-ajax="false" but a bug in jqm (https://github.com/jquery/jquery-mobile/issues/4896) currently prevents this.

Related to that is why we need to disable support for dynamicBaseTag explicitly (which works around the jqm bug)?

JohannesRudolph commented 11 years ago

Kind of related (while trying to make jqm not fail on a form with data-ajax="false" without an action attribute on it): Why is the adapter setting this in jqmDisableHashChange?

if ($.support.dynamicBaseTag) {
            $.support.dynamicBaseTag = false;
            $.mobile.base.set = function () {
            };
        }
tbosch commented 11 years ago

Hi, the dynamic base tag is now enabled again..

tbosch commented 11 years ago

Hi, here is an updated jsfiddle with no action attribute (by which the browser will not post the form), and a data-ajax="false" attribute on the form. This works well: http://jsfiddle.net/FHVMh/14/

Closing this. Please open it again if you have more problems.

Tobias