在AngularJS中使用jQuery移动适配器-应用jqmCompatMode false启用角度路由

Using jQuery Mobile Adapter in AngularJS - Applying jqmCompatMode false to Enable Angular Routing

本文关键字:false jqmCompatMode 应用 启用 路由 适配器 AngularJS 移动 jQuery      更新时间:2023-09-26

我正在学习AngularJS,并构建了一个小型应用程序。现在它的功能已经完成,我想使用jQueryMobile对它进行样式设置。

我加入了tigbro的jquery移动角度适配器,结果(已知),我以前的路由都不起作用。

这里列出了一个解决方案,但不幸的是,我还不知道如何将其应用于我的路由。将jqmCompatMode设置为false的module.config行将放在哪里?

我的路线目前是这样的:

angular.module('myApp', []).
    config(['$routeProvider', function($routeProvider) {
    $routeProvider.
            when('/finds', {templateUrl: 'views/finds-list.html', controller: FindListCtrl}).
            when('/add_find', {templateUrl: 'views/add-find.html', controller: AddFindCtrl}).
            when('/add_find/success', {templateUrl: 'views/add-find-success.html', controller: AddFindSuccessCtrl}).
            when('/find/:findId', {templateUrl: 'views/specific-find.html', controller: SpecificFindCtrl}).
            when('/find/edit/success', {templateUrl: 'views/edit-find-success.html', controller: EditFindSuccessCtrl}).
            when('/find/edit/:findId', {templateUrl: 'views/edit-find.html', controller: EditFindCtrl}).
            when('/find/delete/:findId', {templateUrl: 'views/delete-find.html', controller: DeleteFindCtrl}).
            otherwise({redirectTo: '/finds'});
            }]);

非常感谢!

他的自述有一个拼写错误。他的意思是,您需要将$locationProvider注入到您的配置函数中,并设置$locationProvider.jqmCompatMode(false);

我向他的自述发送了一个拉取请求,以修复拼写错误。

示例:

myApp.config(function($routeProvider, $locationProvider) {
  $routeProvider.when(...);
  $locationProvider.jqmCompatMode(false);
});