Closed giver closed 11 years ago
I have the same issue.
Hi, could you create a jsfiddle for this?
Do you call $.mobile.changePage
directly in your code? With the adapter, the intended way is to change $location
, e.g. $location.path('login.html')
, and define transition options using $location.routeOverride(...)
(see the Readme for details).
Still, calling $.mobile.changePage should also work when called directly...
Thanks, Tobias
Hi,
here is a jsfiddle that directly calls $.mobile.changePage
and works fine: http://jsfiddle.net/ZHKBA/109/
Tobias
Hi @tigbro
I have an a index.html
which include app.js
like this.
index.html
<script src="angular.js"></script>
<script src="angular-adapter.js"></script>
<script src="app.js"></script>
..
<body>
<div ng-controller="MainController" data-role="page" id="main-check" data-theme="z">
...
<div>
</body>
..
app.js
function MainController() {
$.mobile.changePage('login.html');
}
Hi ok, you shouldn't do this :-) The adapter requires one page to be already present in the index.html, and this will be the default page that will be shown when the application is visited.
If you also want to move this page to an external page, you can just put an empty page in your index.html and then do the following:
module.config(function($routeProvider) {
$routeProvider.when('/index.html', {
templateUrl: 'login.html'
});
});
I will investigate if the empty initial page could also be removed.
Tobias
Closing this. That an empty page is required is documented in the Readme.md: https://github.com/tigbro/jquery-mobile-angular-adapter#navigation-and-routes.
Closing this... Tobias
Hi @tigbro,
Can I give you more information on my problem?
Those example is a cut short version of my app.js. So, it can make you misunderstand me in this case.
In my scenario, index.html
is my landing page and app.js
take care of (many) business logic to verify data integrity and whatever to check before move to another page (login.html) if not, user will receive an error message at the index.html
and NOT move to login.html
app.js (just example that reflect my code)
function MainController($scope) {
var passCheck = 0;
passCheck += check1();
passCheck += check2();
passCheck += check3();
passCheck += check4();
if (passCheck) {
$.mobile.changePage('login.html');
} else {
alert('FAIL');
}
}
Last. Why adapter v1.2.0 not cause this problem but v1.2.1 does? How difference between those two?
Thank you for your effort.
When I use
jquery-mobile-angular-adapter - v1.2.1-SNAPSHOT - 2013-03-06
with JQM 1.2.0 Final method$.mobile.changePage('login.html')
the error message has shown below. I do not have any problem withjquery-mobile-angular-adapter v1.2.0