设置pouchdb-authentication(离子)时出错

时间:2016-02-24 15:52:44

标签: angularjs pouchdb

我是角度和离子的新手。我试图设置pouchdb-authentication并得到此错误。我一定在某个地方犯了一些错误,但我无法解决它。请帮忙。在发布之前,我搜索了2天的问题,但没有找到解决方案。

app.js中的

var localDB = new PouchDB('testLogin');
var remoteDB = new PouchDB('http://localhost:5984/testLogin', {skipSetup: true});

并在我的服务中:

remoteDB.signup(userName, password, {
              metadata : {
                email : email
              }
            }, function (err, response) {
                if(err){
                    console.log("failure signup");
                } else{
                    console.log("success signup");
                }
            });


TypeError: remoteDB.signup is not a function
    at Object.self.signup (/localhost:8100/js/services/authentication.js:40:13)
    at Scope.$scope.signup (/localhost:8100/js/controllers/authentication.js:41:16)
    at fn (eval at <anonymous> (/localhost:8100/lib/ionic/js/ionic.bundle.js:26457:15), <anonymous>:4:320)
    at callback (/localhost:8100/lib/ionic/js/ionic.bundle.js:36610:17)
    at Scope.$eval (/localhost:8100/lib/ionic/js/ionic.bundle.js:29158:28)

1 个答案:

答案 0 :(得分:0)

似乎插件实际上并未安装。如果您使用的是<script>标记,那么您只需要确保在PouchDB脚本之后声明了身份验证脚本。否则你需要PouchDB.plugin(require('pouchdb-authentication'))