本文整理汇总了TypeScript中angularfire2.FirebaseListObservable.update方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseListObservable.update方法的具体用法?TypeScript FirebaseListObservable.update怎么用?TypeScript FirebaseListObservable.update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2.FirebaseListObservable
的用法示例。
在下文中一共展示了FirebaseListObservable.update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: updateAp
public updateAp(activityPlan: ActivityPlan): void {
this._activityPlans.update(activityPlan['$key'], {
activities: activityPlan.activities,
totalEnergy: activityPlan.totalEnergy,
totalDuration: activityPlan.totalDuration
});
}
示例2: updateUserPrayer
updateUserPrayer(key: string, newPrayerDetails: string) {
var date = new Date();
this.userPrayers.update( key, {
name: newPrayerDetails,
updatedOn: date.toUTCString()
});
}
示例3: updateEvent
updateEvent(data) {
let promise = this._events.update(data.$key, {attendees: data.attendees });
return promise.then(
(res) => { return "Registered" },
(err) => console.log(err)
)
}
示例4: addMword
addMword( mWord:Mword, saveMword:any ) {
this.words.update( mWord.word, mWord )
.then(_ => {
console.log("addMword: OK");
let m = this.getWord(mWord.word);
this.updateParts( m, mWord.word, saveMword.part, saveMword.pronun );
})
.catch( e => console.log("addMword: Fail"));
}
示例5: toggleStatus
public toggleStatus(item: TodoItem) {
this.todos.update(
item.$key,
{
done: item.done,
updatedAt: firebase.database.ServerValue.TIMESTAMP,
}
);
}
示例6: finishedTodo
finishedTodo(key: string, finished: boolean, isFinished: boolean){
var snapshotFinished = this._af.database.object('hr/todos/'+ key,{ preserveSnapshot: true})
snapshotFinished.subscribe(snapshot => {
isFinished = snapshot.val().finished;
});
if (isFinished == false || isFinished == null){
this.todos.update(key,{finished: true});
isFinished = true;
console.log(isFinished);
}
else{
this.todos.update(key,{finished: false});
isFinished = false;
console.log(isFinished);
}
}
示例7: update
update(key: string, spice: Spice) {
console.log(spice);
var newSpice: Spice = JSON.parse(JSON.stringify(spice));
delete newSpice.$key;
this.spices.update(key, newSpice)
.then(_ => console.log(key + ' update successful'))
.catch(err => console.log(err, key + ' update error: ' + err));
}
示例8: Date
return this.auth.uid$.first().map(uid => {
if (existingRequest) {
this.list$.update(existingRequest.$key, { requestedBy: [...existingRequest.requestedBy, uid] });
} else {
const request: Request = {
data: form,
type: type,
requestedBy: [uid],
createdAt: new Date().toISOString()
};
this.list$.push(request);
}
});
示例9: onDrinkRecord
onDrinkRecord(drankCellarRecord: CellarRecord) {
drankCellarRecord.count = drankCellarRecord.count -1;
if (drankCellarRecord.count <= 0) {
this.cellarRecords.remove(drankCellarRecord.$key);
} else {
this.cellarRecords.update(drankCellarRecord.$key, {count: drankCellarRecord.count});
}
let drankRecord = new DrankRecord(drankCellarRecord);
this.drankRecords.push(drankRecord);
}
示例10: updateMealPlan
public updateMealPlan(mp: MealPlan): void {
this._mealPlans.update(mp['$key'], {
date: mp.date,
breakfast: mp.breakfast,
brunch: mp.brunch,
lunch: mp.lunch,
snack: mp.snack,
dinner: mp.dinner,
numericIntake: mp.numericIntake,
percentIntake: mp.percentIntake,
remainingIntake: mp.remainingIntake,
requiredIntake: mp.requiredIntake
});
}