1

I am developing a prototype web application. I used Yeoman to create an Angular application with Grunt, NPM, and Bower etc. The PouchDB API says you can enable debugging like so:

PouchDB.debug.enable('*');

This however requires the node debug module to be installed. I have tried installing it via bower and referencing it in my index.html but to no avail. How do I inject the debug module into Angular? Or is this function only available when the PouchDB is ran from a Node.js server?

EDIT:

The exact error I am getting is bellow. The line it complains about is: 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">
4

2 回答 2

3

当您使用 PouchDB 时,已经安装了调试模块。除了 call ,你不需要做任何事情PouchDB.debug.enable('*')。:)

于 2014-12-05T00:58:34.523 回答
1

请注意,在 PouchDB v7.0.0中,为此需要加载单独的插件。

于 2018-11-13T17:13:05.017 回答