本文整理汇总了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;
}
});
});
}
示例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;
}
});
});
}
示例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]);
})
})
})
示例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');
}
}