2014-12-04 81 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