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


TypeScript AngularFireList.valueChanges方法代碼示例

本文整理匯總了TypeScript中angularfire2/database.AngularFireList.valueChanges方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AngularFireList.valueChanges方法的具體用法?TypeScript AngularFireList.valueChanges怎麽用?TypeScript AngularFireList.valueChanges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angularfire2/database.AngularFireList的用法示例。


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

示例1: constructor

 constructor(private route: ActivatedRoute, private router: Router, db: AngularFireDatabase) {
   this.sub = this.route.params.subscribe(params => {
     this.id = params['id'];
   });
   this.itemsRef = db.list('items/' + this.id);
   this.items = this.itemsRef.valueChanges();
   this.playlist = [];
   this.itemsSubsrciption = this.items
     .subscribe(items=> {
       items.forEach((item: any) => {
         if(item.fork) {
           this.forked = true;
           this.forkedFrom = item.fork.forked_from;
           this.forkedTitle = item.fork.forked_from_title;
         }
         if(item.url && item.embed_url) {
           this.playlist.push({url: item.url, embed_url: item.embed_url, image_url: item.image_url, type: item.type});
         }
         if(item.title && item.createdAt) {
           this.createdAt = item.createdAt;
           this.title = item.title;
           this.fork_count = item.fork_count;
         }
       });
     });
 }
開發者ID:fobabett,項目名稱:TuneFork,代碼行數:26,代碼來源:playlist.component.ts

示例2: constructor

  constructor(
    private route: ActivatedRoute,
    private router: Router,
    private db: AngularFireDatabase,
    private sanitizer: DomSanitizer,
    private spotifyService: SpotifyService,
    private soundcloudService: SoundcloudService) {
    this.sanitizer = sanitizer;
    this.id = this.route.snapshot.params.id;
    this.itemsRef = db.list('items/' + this.id);
    this.forkedItems = this.itemsRef.valueChanges();
    this.items = db.list('items');
    // this.items = af.database.list('/items');
    this.playlist = [];

    this.forkedItemsSubsciption = this.forkedItems
      .subscribe(items=> {
        items.forEach((item:any) => {
          if(item.url && item.embed_url) {
            this.playlist.push({url: item.url, embed_url: item.embed_url, image_url: item.image_url});
          }
          if(item.title) {
            this.forkedTitle = item.title;
            this.title = item.title;
          }
          if(item.fork_count !== undefined) {
            this.fork_count = item.fork_count+1;
            this.forkKey = item.$key;
          }
        });
      });
  }
開發者ID:fobabett,項目名稱:TuneFork,代碼行數:32,代碼來源:forked-playlist.component.ts

示例3: resolve

 }).then((_uidDQ: any) => {
   this.listOfCTs$ = this.db.list(`/`);
   this.listOfCTs$.valueChanges().subscribe(_CTs => {
     _CTs.forEach(_DQs => {
       if(_DQs['users'] != undefined)
         if (_DQs['users'][_uidDQ] != undefined)
           resolve(_DQs['users'][_uidDQ]);
     })
   })
 })
開發者ID:dekonunes,項目名稱:ConneCT-App,代碼行數:10,代碼來源:user.service.ts

示例4: constructor

  constructor(
    public db: AngularFireDatabase,
    public router: Router,
    public globalService: GlobalService,
    public localCart: LocalCartService,
    private title: Title,
    private meta: Meta
  ) {
    this.charges = {};
    this.newCharge = {};
    this.order = globalService.order.getValue();
    this.user = globalService.user.getValue();
    const now = new Date().getTime();

    if (this.user) {
      this.sources = db.list('/stripe_customers/' + this.user.uid + '/sources');
    } else {
      router.navigateByUrl('cart');
    }

    if (this.sources) {
      this.sources.valueChanges().subscribe((s) => {
        this.newCharge.source = s[(s.length - 1)];
      });
    } else {
      router.navigateByUrl('cart');
    }

    if (this.order) {
      if (this.user) {
        this.order.uid = this.user.uid;
      }
      this.order.date = now;
      this.order.rdate = (now * -1);
      this.order.status = 'PAID';
    }

    if (!this.order || !this.order.billing) {
      router.navigateByUrl('cart');
    }
  }
開發者ID:mogeta,項目名稱:firebase-cms,代碼行數:41,代碼來源:checkout-review.component.ts


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