本文整理汇总了TypeScript中angularfire2/database.FirebaseListObservable类的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseListObservable类的具体用法?TypeScript FirebaseListObservable怎么用?TypeScript FirebaseListObservable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FirebaseListObservable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: save
private save(item: any) {
if (item.$key) {
return this.items.update(item.$key, { name: item.name });
} else {
return this.items.push({ name: item.name, url: item.url, fullPath: item.fullPath });
}
}
示例2:
handler: data => {
if (isNew) {
this.ListaPlaca.push({ 'placa': data.placa, 'tipo' : data.tipo });
} else {
this.ListaPlaca.update(placa, { placa: data.placa });
}
}
示例3:
this.sub = this.route.params.subscribe(params => {
if(params['id'] != null) {
this.id = params['id'];
console.log(this.id);
this.items = db.list('/data', { preserveSnapshot: true });
this.items
.subscribe(snapshots => {
snapshots.forEach(snapshot => {
console.log(snapshot.key)
console.log(snapshot.val().baslik)
if(this.id == snapshot.key)
{
this.Form.controls["yazi"].setValue(snapshot.val().yazi);
this.Form.controls["baslik"].setValue(snapshot.val().baslik);
this.Form.controls["yazar"].setValue(snapshot.val().yazar);
this.Form.controls["img"].setValue(snapshot.val().img);
}
});
})
}
});
示例4: updateItem
updateItem() {
console.log(this.Form.value.baslik);
this.items.update(this.id, {baslik: this.Form.value.baslik,
yazi: this.Form.value.yazi,
img: this.Form.value.img,
yazar: this.Form.value.yazar});
}
示例5: createRecipe
createRecipe(recipe: Recipe) {
console.log('create');
const recipeResponse = this.recipes.push(recipe);
const myRecipes = this.db.object(`chefs/${this.chefSvc.currentUserId}/my-recipes/${recipeResponse.key}`);
myRecipes.set(true);
this.router.navigate(['/recipes', recipeResponse.key]);
}
示例6: addTable
addTable(newName: string) {
this.tablesDB.push({ name: newName, count: "0", data:
[
{name: "player1", money: "0"},
{name: "player2", money: "0"},
{name: "player3", money: "0"},
{name: "player4", money: "0"}
] });
}
示例7: incrementVoteValue
incrementVoteValue(result:Submit){
if(result == null){
console.log("Error");
this.nothingChecked = true;
}
else{
result.vote = result.vote + 1;
this.items.update(result.$key, result);
this.nothingChecked = false;
}
}
示例8: sendMessage
sendMessage (message: string) {
console.log(this.user)
const { email } = this.user
const timestamp = this.getTimeStamp()
this.chatMessages = this.getMessages()
this.chatMessages.push({
email,
message,
timeSent: timestamp,
})
console.log('send message!')
}
示例9: sendInquiryData
sendInquiryData(name : string, email : string, message : string){
if(name == null || email == null || message == null){
this.fieldsRequired = true;
}
else
{
this.fieldsRequired = false;
this.items.push({name: name, email: email, message: message});
this.name = null;
this.email = null;
this.message = null;
}
}
示例10: sendSubmissionData
sendSubmissionData(topic : string, option1 : string, option2 : string){
if(topic == null || option1 == null || option2 == null){
this.fieldsRequired = true;
}
else
{
this.fieldsRequired = false;
this.items.push({topic: topic, option1: option1, option2: option2, voteCount: 0});
this.topic = null;
this.option1 = null;
this.option2 = null;
}
}