本文整理匯總了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');
}
}