【发布时间】:2019-02-22 05:31:42
【问题描述】:
我正在尝试将 couchbase 与我的 nativescript 应用程序一起使用,但在尝试输入正在使用它的组件时出现错误。
这是我的 couchbase.servive.ts
import { Injectable } from "@angular/core";
import { Couchbase } from 'nativescript-couchbase';
@Injectable()
export class CouchbaseService {
private database: any;
public constructor() {
this.database = new Couchbase("confusion");
}
public getDatabase() {
return this.database;
}
public getDocument(docId: string) {
return this.database.getDocument(docId);
}
public createDocument(data: any, docId: string) {
return this.database.createDocument(data, docId);
}
public updateDocument(docId: string, data: any) {
return this.database.updateDocument(docId, data);
}
public deleteDocument(docId: string) {
return this.database.deleteDocument(docId);
}
}
在我的收藏夹.component.ts
我导入 couchbase 服务并像这样分配 docId ( docId: string = "收藏夹"; )
我收到了这个错误
JS:管理器错误:无法读取未定义的属性“AndroidContext” JS:错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“getDocument” JS:TypeError:无法读取未定义的属性“getDocument”
【问题讨论】:
-
您确定您使用的是正确的插件吗?您应该使用自述文件中所述的
nativescript-couchbase-plugin。nativescript-couchbase不再维护。 -
非常感谢!!!是的,我使用了错误的插件
标签: typescript nativescript couchbase