I spent maybe 5 hours trying to get around a similar problem. It turned out that phone-gap / cca for some reason adds the application identifier to the hash of the URL. Thus, the route did not match, and the user was constantly redirected by calling $routeProvider.otherwise() .
(since then I found a known issue with CCA, which is even fixed , just not released!)
In any case, if you have problems connecting ngRoute to mobile chrome tools, and Phonegap will try to add two additional comparable groups to your routes. For example, take this example:
$routeProvider.when('/', { templateUrl: 'templates/home.html', controller: 'HomeCtrl' }); $routeProvider.when('/some-page', { templateUrl: 'templates/some-page.html', controller: 'SomePageCtrl' }); $routeProvider.when('/another-page', { templateUrl: 'templates/another-page.html', controller: 'AnotherPageCtrl' }); $routeProvider.otherwise({ redirectTo: '/' });
The routes do not match the addition of extra bits to the URL, but you can get around it like this:
$routeProvider.when('/:a?/:b?/some-page', { templateUrl: 'templates/some-page.html', controller: 'SomePageCtrl' }); $routeProvider.when('/:a?/:b?/another-page', { templateUrl: 'templates/another-page.html', controller: 'AnotherPageCtrl' }); $routeProvider.when('/:a?/:b?/', { templateUrl: 'templates/home.html', controller: 'HomeCtrl' }); $routeProvider.otherwise({ redirectTo: '/' });
Pay attention to the two additional groups that I added. Also note that the base route comes last, otherwise it will match all / most routes if the URL is generated correctly!
kzar
source share