【问题标题】:Use PouchDB with angular 5 or 6使用角度为 5 或 6 的 PouchDB
【发布时间】:2018-08-22 21:18:48
【问题描述】:

如何将 PouchDB 添加到 Angular 5 或 6 项目?我正在使用 Angular 6,但找不到任何方法。

【问题讨论】:

    标签: angular5 angular6 pouchdb


    【解决方案1】:

    是的,您可以通过 library

    使用 PouchDB 和 angular
    import PouchDB from 'pouchdb';
    

    这是我遇到的一个示例 Poucdhb with angular 项目。

    你可以如下使用,

      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;在 polyfills.ts 文件中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-11
    • 2018-12-21
    • 1970-01-01
    • 2018-10-21
    • 2019-02-20
    • 2019-02-19
    • 1970-01-01
    相关资源
    最近更新 更多