本文整理汇总了TypeScript中@angular/fire.FirebaseApp.database方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseApp.database方法的具体用法?TypeScript FirebaseApp.database怎么用?TypeScript FirebaseApp.database使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/fire.FirebaseApp
的用法示例。
在下文中一共展示了FirebaseApp.database方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach((done: any) => {
toKey = (val: any) => val.key;
val1 = { key: 'key1' };
val2 = { key: 'key2' };
val3 = { key: 'key3' };
app.database().ref().remove(done);
questions = FirebaseListFactory(app.database().ref(`questions`));
questionsSnapshotted = FirebaseListFactory(app.database().ref(`questionssnapshot`), { preserveSnapshot: true });
ref = questions.$ref;
refSnapshotted = questionsSnapshotted.$ref;
});
示例2: inject
inject([FirebaseApp, AngularFireDatabase], (_app: FirebaseApp, _db: AngularFireDatabase) => {
app = _app;
db = _db;
ref = app.database().ref();
O = new FirebaseObjectObservable((observer: Observer<any>) => {
}, ref);
})();
示例3: it
it('should call off on all events when disposed', (done: any) => {
const questionRef = app.database().ref().child('questions');
subscription = FirebaseListFactory(questionRef).subscribe(_ => {
let firebaseSpy = spyOn(questionRef, 'off').and.callThrough();
expect(firebaseSpy).not.toHaveBeenCalled();
subscription.unsubscribe();
expect(firebaseSpy).toHaveBeenCalled();
done();
});
});
示例4: FirebaseListFactory
.run(() => {
// Creating a new observable so that the current zone is captured.
subscription = FirebaseListFactory(app.database().ref(`questions`))
.filter(d => d
.map((v: any) => v.$value)
.indexOf('in-the-zone') > -1)
.subscribe(data => {
expect(Zone.current.name).toBe('newZone');
done();
});
});