當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angularfire2.FirebaseListObservable類代碼示例

本文整理匯總了TypeScript中angularfire2/angularfire2.FirebaseListObservable的典型用法代碼示例。如果您正苦於以下問題:TypeScript FirebaseListObservable類的具體用法?TypeScript FirebaseListObservable怎麽用?TypeScript FirebaseListObservable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FirebaseListObservable類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getNewTaskListID

 /**
  * Generates and returns a unique id for a task list.
  * @returns {string}
  */
 private getNewTaskListID(): string {
   let taskLists: FirebaseListObservable<any[]> =
       this.angularFire.database.list(TASK_LIST_METADATA_PATH);
   return taskLists.push(null).key;
 }
開發者ID:hanaum,項目名稱:choose_to_go,代碼行數:9,代碼來源:taskList.service.ts

示例2: saveEvent

  saveEvent(event: EventModel): EventModel {
    if (!event) {
      return null;
    }

    if (event.$key) {
      this.events$.update(event.$key, _.omit(event, ['$key', '$exists']));
    } else {
      this.events$.push(event);
    }
    return event;
  }
開發者ID:vincent314,項目名稱:jsrol-ng2,代碼行數:12,代碼來源:jsrol.service.ts

示例3: saveTrack

  saveTrack(track: TrackModel, kml?: string): TrackModel {
    // Should save a new KML or keep existing ?
    let kmlObject = {};
    if (kml) {
      console.debug('Saving a new KML', kml);
      kmlObject = {kml: this.saveKml(kml).key};
    }

    const newTrack: TrackModel = Object.assign(
      {},
      track,
      kmlObject);

    if (newTrack.$key) {
      console.debug('Update track');
      this.tracks$.update(newTrack.$key, _.omit(newTrack, ['$key', '$exists']));
    } else {
      console.debug('Create a new track');
      this.tracks$.push(newTrack);
    }
    return newTrack;

  }
開發者ID:vincent314,項目名稱:jsrol-ng2,代碼行數:23,代碼來源:jsrol.service.ts

示例4: save

  save(name:string,
       length:string,
       key:string,
       tempo:string,
       artist:string,
       genre:string,
       lyrics:string,
       notes:string,
       other:string
  ){
    if(this.isNew === true){

      //this.artists.map( artists => artists.filter(artist => artist.name === artist.name));

      var newItemKey = this.songs.push({name:name,length:length,key:key, tempo:tempo,lyrics:lyrics, uid:this.uid}).key;


    }
    else
    {

      this.getOrCreateArtist(artist).then(
        function(result){
          var artistKey;
          if(result){
            artistKey = result['$key'];
          }
          else{
            artistKey = this.artists.set({name:artist}).key;
          }

          /*const user = this.af.database.object(`users/${login}`);
          user.subscribe(data => {
            if(data.$value !== null) {
              console.log('User does not exist');
            } else {
              console.log('User does exist');
            }
          });*/

          this.song.update({name:name,length:length,key:key, tempo:tempo, lyrics:lyrics, artistId:artistKey});
        }
      );

    }

    this.router.navigate(['/songs']);
  }
開發者ID:timburnham73,項目名稱:slhweb,代碼行數:48,代碼來源:song-edit.component.ts

示例5: function

        function(result){
          var artistKey;
          if(result){
            artistKey = result['$key'];
          }
          else{
            artistKey = this.artists.set({name:artist}).key;
          }

          /*const user = this.af.database.object(`users/${login}`);
          user.subscribe(data => {
            if(data.$value !== null) {
              console.log('User does not exist');
            } else {
              console.log('User does exist');
            }
          });*/

          this.song.update({name:name,length:length,key:key, tempo:tempo, lyrics:lyrics, artistId:artistKey});
        }
開發者ID:timburnham73,項目名稱:slhweb,代碼行數:20,代碼來源:song-edit.component.ts

示例6: deleteTrack

 deleteTrack(track: TrackModel): void {
   if (track.kml) {
     this.removeKml(track.kml);
   }
   this.tracks$.remove(track.$key);
 }
開發者ID:vincent314,項目名稱:jsrol-ng2,代碼行數:6,代碼來源:jsrol.service.ts

示例7: removeKml

 removeKml(kml: string) {
   this.kmls$.remove(kml);
 }
開發者ID:vincent314,項目名稱:jsrol-ng2,代碼行數:3,代碼來源:jsrol.service.ts

示例8: saveKml

 saveKml(kml: string): firebase.database.ThenableReference {
   return this.kmls$.push(kml);
 }
開發者ID:vincent314,項目名稱:jsrol-ng2,代碼行數:3,代碼來源:jsrol.service.ts

示例9: deleteEvent

 deleteEvent(key: string) {
   this.events$.remove(key);
 }
開發者ID:vincent314,項目名稱:jsrol-ng2,代碼行數:3,代碼來源:jsrol.service.ts


注:本文中的angularfire2/angularfire2.FirebaseListObservable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。