【问题标题】:Using jQuery Mobile Adapter in AngularJS - Applying jqmCompatMode false to Enable Angular Routing在 AngularJS 中使用 jQuery Mobile Adapter - 应用 jqmCompatMode false 来启用 Angular 路由
【发布时间】:2012-07-12 03:50:09
【问题描述】:

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

我已经加入了 tigbro 的 jquery-mobile-angular-adapter,结果(已知的)结果是,我以前的路线都不起作用。

有一个解决方案概述了here,但不幸的是我还不明白如何将它应用到我的路由中。将 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'});
            }]);

非常感谢!

【问题讨论】:

    标签: javascript jquery-mobile angularjs


    【解决方案1】:

    他的自述文件有错字。他的意思是,你需要将$locationProvider注入到你的config函数中,并设置$locationProvider.jqmCompatMode(false);

    我向他的自述文件发送了一个拉取请求以修复错字。

    例子:

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

    【讨论】:

      猜你喜欢
      • 2016-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-11
      • 1970-01-01
      • 2014-11-21
      • 2014-07-15
      • 2021-04-22
      相关资源
      最近更新 更多