2014-12-04 30 views
0

我正在开发一个原型Web应用程序。我用约曼创建具有咕噜,NPM和凉亭等的角应用程序PouchDB API说,你可以启用调试像这样:如何在Angular中启用PouchDB调试

PouchDB.debug.enable('*'); 

然而,这需要安装的node debug module。我曾尝试通过bower安装它,并在我的index.html中引用它,但无济于事。如何将调试模块注入到Angular中?或者,这个函数仅在PouchDB从Node.js服务器运行时才可用?

编辑:

我得到的确切的错误是波纹管。它抱怨该行的是: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"> 

回答

2

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

+0

感谢您的答复,我必须做错了什么,因为它仍然无法正常工作。我更新了我的问题。 – Connel 2014-12-05 14:32:50

+0

好吧,我现在看到。调试仅在PouchDB 3.2.0+中可用! – nlawson 2014-12-07 18:12:38