Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.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
Angular 角度firebase不支持的字段值_Angular_Typescript_Firebase_Firebase Realtime Database_Firebase Storage - Fatal编程技术网

Angular 角度firebase不支持的字段值

Angular 角度firebase不支持的字段值,angular,typescript,firebase,firebase-realtime-database,firebase-storage,Angular,Typescript,Firebase,Firebase Realtime Database,Firebase Storage,我有uplaod.ts文件: export class Project { $key: string; file: File; name: string; title: string; //can't write this to db with ngModel (look below) cat: string; //can't write this to db with ngModel (look below) url: string; progress: numb

我有uplaod.ts文件:

export class Project {
  $key: string;
  file: File;
  name: string;
  title: string;  //can't write this to db with ngModel (look below)
  cat: string; //can't write this to db with ngModel (look below)
  url: string;
  progress: number;
  createdAt: Date = new Date();

  constructor(file: File) {
    this.file = file;
  }
}
然后在upload.service中,我有一个带有savefiledata()的pushUpload()函数:

upload.html:

<div class="box">
  <h3>Single File Upload</h3>

  <label>
    <input type="file" class="button" (change)="detectFiles($event)">
  </label>
  <label>
    <input [(ngModel)]="proinfo.title" type="text" class="button">
  </label>
  <label>
    <input [(ngModel)]="proinfo.cat" type="text" class="button">
  </label>
  <button class="button is-primary"
          [disabled]="!selectedFiles"
          (click)="uploadSingle()">
    Upload Single
  </button>
  <hr>

  <h3>Multiple File Upload</h3>

  <label>
    <input type="file" class="button" (change)="detectFiles($event)" multiple>
  </label>
  <button class="button is-primary"
          [disabled]="!selectedFiles"
          (click)="uploadMulti()">
    Upload Multiple
  </button>
</div>

单文件上传
上传单个

多文件上传 上传多个
我收到0个错误,数据未保存在数据库中(仅名称、url和进度)。

主要问题是:如何将标题和cat保存在数据库中,并将url、名称和进度保存在同一个列表中

selectedFiles: FileList | null;
  currentUpload: Project;
     proinfo = {} as Project;


 uploadSingle() {
    const file = this.selectedFiles;
    if (file && file.length === 1) {
      this.currentUpload = new Project(file.item(0));
      this.navSrv.pushUpload(this.currentUpload);
    } else {
      console.error('No file found!');
    }
  }
<div class="box">
  <h3>Single File Upload</h3>

  <label>
    <input type="file" class="button" (change)="detectFiles($event)">
  </label>
  <label>
    <input [(ngModel)]="proinfo.title" type="text" class="button">
  </label>
  <label>
    <input [(ngModel)]="proinfo.cat" type="text" class="button">
  </label>
  <button class="button is-primary"
          [disabled]="!selectedFiles"
          (click)="uploadSingle()">
    Upload Single
  </button>
  <hr>

  <h3>Multiple File Upload</h3>

  <label>
    <input type="file" class="button" (change)="detectFiles($event)" multiple>
  </label>
  <button class="button is-primary"
          [disabled]="!selectedFiles"
          (click)="uploadMulti()">
    Upload Multiple
  </button>
</div>