Skip to content

Commit

Permalink
introduced jqmCompatMode in , which is also able to deactivate jqm ha…
Browse files Browse the repository at this point in the history
…sh listening and changing
  • Loading branch information
Tobias Bosch committed Jul 5, 2012
1 parent 8d2bedc commit 73a21da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,27 +207,27 @@

var ng = angular.module("ng");
ng.config(['$locationProvider', function ($locationProvider) {
var plainMode = true;
var jqmCompatMode = true;
/**
* @ngdoc property
* @name ng.$locationProvider#plainMode
* @name ng.$locationProvider#jqmCompatMode
* @methodOf ng.$locationProvider
* @description
* @param {string=} mode Use plain strategy.
* @param {string=} mode Use jqm compatibility mode for navigation.
* @returns {*} current value if used as getter or itself (chaining) if used as setter
*/
$locationProvider.plainMode = function (mode) {
$locationProvider.jqmCompatMode = function (mode) {
if (angular.isDefined(mode)) {
plainMode = mode;
jqmCompatMode = mode;
return this;
} else {
return plainMode;
return jqmCompatMode;
}
};

var _$get = $locationProvider.$get;
$locationProvider.$get = ['$injector', '$sniffer', '$browser', function ($injector, $sniffer, $browser) {
if (plainMode) {
if (jqmCompatMode) {
// Angular should not use the history api and use the hash bang location service,
// which we will extend below.
$sniffer.history = false;
Expand All @@ -239,6 +239,11 @@

return $location;
} else {
// deactivate jqm hash listening and changing
$.mobile.pushStateEnabled = false;
$.mobile.hashListeningEnabled = false;
$.mobile.changePage.defaults.changeHash = false;

return $injector.invoke(_$get, $locationProvider);
}
}];
Expand Down

0 comments on commit 73a21da

Please sign in to comment.