0

I'm writing a mobile web app with jQueryMobile and I put in AngularJS to handle data binding. But this introduces routing problems on mobile devices. Below is the minimal code I could write to reproduce the problem. Everything works OK on Chrome on desktop, but when I try the same page from my android device I get the nasty "Error loading page". Problem can be fixed by using data-url for navigation but there's catch. I also need to package it up with phone gap. This means html is loaded by file:// and direct navigation(data-url) doesn't work(I tried)

<!DOCTYPE html>
<html ng-app>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
        <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>

        <script src="https://raw.github.com/tigbro/jquery-mobile-angular-adapter/master/compiled/jquery-mobile-angular-adapter-1.2.0.js"></script>        
    </head>

    <body>
        <div data-role="page" id="main">
            <a data-role="button" href="#sub">sub</a>
        </div>

        <div data-role="page" id="sub">
            <p>sub page</p>
        </div>
    </body>

</html>

Upon clicking the "sub" button user should be directed to hostname/#sub and it is on Chrome but weird things happen on android and browser is routed to hostname/#!/%23sub I guess this is URL encoded?

Also I should point out that by removing just the two script refenrences for angular and for JQM-angular adapter everything works(and no databinding of course).

1
  • Your page works as expected on iPhone Safari IOS 6.01. Location is #sub and the sub page is displayed. Commented Jan 16, 2013 at 14:03

1 Answer 1

1

i tried removing angular-jquery adapter and everything works as if by magic. also no issues with angular and jquery clashing.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.