本文整理汇总了TypeScript中angularfire2.FirebaseApp.database方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseApp.database方法的具体用法?TypeScript FirebaseApp.database怎么用?TypeScript FirebaseApp.database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2.FirebaseApp
的用法示例。
在下文中一共展示了FirebaseApp.database方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, PlatformRef], (_app: FirebaseApp, _platform: PlatformRef) => {
app = _app;
rootRef = app.database().ref();
questionsRef = rootRef.child('questions');
listOfQuestionsRef = rootRef.child('list-of-questions');
defaultPlatform = _platform;
})();
示例3: inject
inject([FirebaseApp, AngularFireDatabase], (_app: FirebaseApp, _db: AngularFireDatabase) => {
app = _app;
db = _db;
ref = app.database().ref();
O = new FirebaseObjectObservable((observer: Observer<any>) => {
}, ref);
})();
示例4: 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();
});
});
示例5: 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();
});
});
示例6: it
it('should process a new child_changed event', (done) => {
const aref = ref(rando());
const obs = listChanges(aref, ['child_added','child_changed'])
const sub = obs.skip(1).take(1).subscribe(changes => {
const data = changes.map(change => change.payload.val());
expect(data[1].name).toEqual('lol');
}).add(done);
app.database().goOnline();
aref.set(batch).then(() => {
aref.child(items[1].key).update({ name: 'lol'});
});
});