我该如何将PouchDB添加到Angular 5或6项目中?我正在使用Angular 6,但找不到任何方法来实现。
你可以使用这个库
在Angular中使用PouchDB。
import PouchDB from 'pouchdb';
这是我发现的一个涉及IT技术的示例使用Angular和PouchDB Cloudant
项目。
您可以按照以下步骤使用它:
private db: any;
private isInstantiated: boolean;
private listener: EventEmitter<any> = new EventEmitter();
public constructor() {
if (!this.isInstantiated) {
this.db = new PouchDB('locosporalva');
this.isInstantiated = true;
}
}
(window as any).global = window;
在启动时需要用来解决global is not defined
错误。 - aderesh