【问题标题】:How to enable PouchDB Debug in Angular如何在 Angular 中启用 PouchDB 调试
【发布时间】:2018-11-14 01:13:05
【问题描述】:

我正在开发一个原型网络应用程序。我使用 Yeoman 创建了一个带有 Grunt、NPM 和 Bower 等的 Angular 应用程序。PouchDB API 说你可以像这样启用调试:

PouchDB.debug.enable('*');

然而,这需要安装node debug module。我尝试通过 bower 安装它并在我的 index.html 中引用它,但无济于事。如何将调试模块注入 Angular?还是只有在从 Node.js 服务器运行 PouchDB 时才能使用此功能?

编辑:

我得到的确切错误如下。它抱怨的线路是:PouchDB.debug.enable('*');

TypeError: Cannot read property 'enable' of undefined
    at new <anonymous> (http://localhost:9000/scripts/services/taskdb.js:13:15)
    at invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
    at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4140:23)
    at Object.<anonymous> (http://localhost:9000/bower_components/angular/angular.js:3998:24)
    at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
    at Object.enforcedReturnValue [as $get] (http://localhost:9000/bower_components/angular/angular.js:3982:37)
    at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
    at http://localhost:9000/bower_components/angular/angular.js:3947:37
    at getService (http://localhost:9000/bower_components/angular/angular.js:4088:39)
    at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4120:13)
angular.js:11413 TypeError: Cannot read property 'enable' of undefined
    at new <anonymous> (http://localhost:9000/scripts/services/taskdb.js:13:15)
    at invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
    at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4140:23)
    at Object.<anonymous> (http://localhost:9000/bower_components/angular/angular.js:3998:24)
    at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
    at Object.enforcedReturnValue [as $get] (http://localhost:9000/bower_components/angular/angular.js:3982:37)
    at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
    at http://localhost:9000/bower_components/angular/angular.js:3947:37
    at getService (http://localhost:9000/bower_components/angular/angular.js:4088:39)
    at invoke (http://localhost:9000/bower_components/angular/angular.js:4120:13) <div ng-view="" class="ng-scope">

【问题讨论】:

    标签: javascript angularjs pouchdb node-debugger


    【解决方案1】:

    当你使用 PouchDB 时,调试模块已经安装好了。除了致电PouchDB.debug.enable('*'),您无需执行任何操作。 :)

    【讨论】:

    • 感谢您的回复,我一定是做错了什么,因为它仍然无法正常工作。我已经更新了我的问题。
    • 啊好吧,我明白了。调试仅在 PouchDB 3.2.0+ 中可用!
    【解决方案2】:

    请注意,在 PouchDB v7.0.0 中,loading a separate plugin 是必需的。

    【讨论】:

      猜你喜欢
      • 2016-11-16
      • 2014-05-17
      • 1970-01-01
      • 2016-12-31
      • 1970-01-01
      • 2021-06-06
      • 2012-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多