i角,angularfire2 我遇到错误
未处理的承诺拒绝:无法执行“交易” 'IDBDatabase':数据库连接正在关闭。 ;区域: 任务:Promise.then;值:DOMException:执行失败 “ IDBDatabase”上的“事务”:数据库连接正在关闭。
我的简单代码是
import { Component } from '@angular/core';
import { AngularFirestore } from '@angular/fire/firestore';
import { Observable, from } from 'rxjs';
import { map } from 'rxjs/operators';
import { Trip } from '../models/Trip';
@Component({
selector: 'app-root',
template: `
<ul>
<li *ngFor="let item of items | async">
{{ item.tripname }}
</li>
</ul>
`
})
export class TestpageComponent {
items: Observable<any[]>;
constructor(db: AngularFirestore) {
this.items = db.collection('trips').snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data() as Trip;
const id = a.payload.doc.id;
return { id, ...data };
}))
);
}
ngOnInit() {
}
}
请帮助