Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 正在寻找连接我的离子4项目与数据库。但不断出现错误';can';t访问词汇声明';_Ionic Framework_Pouchdb - Fatal编程技术网

Ionic framework 正在寻找连接我的离子4项目与数据库。但不断出现错误';can';t访问词汇声明';

Ionic framework 正在寻找连接我的离子4项目与数据库。但不断出现错误';can';t访问词汇声明';,ionic-framework,pouchdb,Ionic Framework,Pouchdb,当我尝试访问此页面时,我不断收到“无法访问词法声明”错误,但当我对Pocket db语句进行注释时,它工作正常 import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import PouchDB from 'pouchdb'; @Component({ selector: 'app-newperson', templateUrl: './newperson

当我尝试访问此页面时,我不断收到“无法访问词法声明”错误,但当我对Pocket db语句进行注释时,它工作正常

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import PouchDB from 'pouchdb';

@Component({
  selector: 'app-newperson',
  templateUrl: './newperson.page.html',
  styleUrls: ['./newperson.page.scss'],
})
export class NewpersonPage implements OnInit {

  private name;
  private email;
  private phone;
  private db;

  constructor(
    private router : Router
  ) {
    // this.setupDB();
  }

  setupDB() {
    this.db = new PouchDB('contacts');
  }

  ngOnInit() {
    // console.log(PouchDB);
    
    this.setupDB();
    this.name = 'John Doe';
  }

  goBack() {
    this.router.navigate(["/home"]);
  }

  save() {
    // this.db.post({
    //   name: this.name,
    //   email: this.email,
    //   phone: this.phone
    // })
    console.log('save clicked');
    
  }

}

我在这个阶段的主要目标是刚刚开始使用数据库。还有youtube视频链接:-
只是确定一下。您是否向ionic project package.json中添加了PockDB?在我的项目中,db被定义为any

私人db:任何