设置 pouchdb 身份验证时出错(离子)
Error while setting up pouchdb-authentication (ionic)
我是 angular 和 ionic 的新手。我试图设置 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)
好像没有真正安装插件。如果您使用 <script>
标签,那么您只需要确保在 PouchDB 脚本之后声明身份验证脚本。否则你需要做 PouchDB.plugin(require('pouchdb-authentication'))
.
我是 angular 和 ionic 的新手。我试图设置 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)
好像没有真正安装插件。如果您使用 <script>
标签,那么您只需要确保在 PouchDB 脚本之后声明身份验证脚本。否则你需要做 PouchDB.plugin(require('pouchdb-authentication'))
.