在AngularJS中使用jQuery Mobile Adapter - 将jqmCompatMode应用于false以启用Angular Routing

Tra*_*rae 2 javascript jquery-mobile angularjs

我正在学习AngularJS并构建了一个小应用程序.现在功能已经完成了,我想用jQuery Mobile来设置它.

我已经放弃了tigbro的jquery-mobile-angular-adapter和作为(已知)结果,我之前的路线都没有工作.

有概括的解决方案在这里,但不幸的是我还不知道如何将其应用到我的路由.module.config行将jqmCompatMode设置为false会在哪里?

我的路线目前看起来像这样:

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'});
            }]);
Run Code Online (Sandbox Code Playgroud)

非常感谢!

And*_*lin 6

他的自述文件有拼写错误.他的意思是,你需要注入$locationProvider你的配置功能,然后设置$locationProvider.jqmCompatMode(false);.

我发送了拉动请求到他的自述文件来修复错字.

例:

myApp.config(function($routeProvider, $locationProvider) {
  $routeProvider.when(...);
  $locationProvider.jqmCompatMode(false);
});
Run Code Online (Sandbox Code Playgroud)