当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript FirebaseApp.database方法代码示例

本文整理汇总了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;
 });
开发者ID:Tetsumote,项目名称:angularfire2,代码行数:11,代码来源:firebase_list_factory.spec.ts

示例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;
 })();
开发者ID:cartant,项目名称:angularfire2,代码行数:7,代码来源:angularfire2.spec.ts

示例3: inject

 inject([FirebaseApp, AngularFireDatabase], (_app: FirebaseApp, _db: AngularFireDatabase) => {
   app = _app;
   db = _db;
   ref = app.database().ref();
   O = new FirebaseObjectObservable((observer: Observer<any>) => {
   }, ref);
 })();
开发者ID:Tetsumote,项目名称:angularfire2,代码行数:7,代码来源:firebase_object_observable.spec.ts

示例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();
   });
 });
开发者ID:Tetsumote,项目名称:angularfire2,代码行数:10,代码来源:firebase_list_factory.spec.ts

示例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();
     });
 });
开发者ID:Tetsumote,项目名称:angularfire2,代码行数:11,代码来源:firebase_list_factory.spec.ts

示例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'});
   });
 });
开发者ID:acipher,项目名称:angularfire2,代码行数:12,代码来源:changes.spec.ts


注:本文中的angularfire2.FirebaseApp.database方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。