当前位置: 首页>>代码示例>>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;未经允许,请勿转载。