本文整理汇总了TypeScript中angularfire2/database.FirebaseListObservable.push方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseListObservable.push方法的具体用法?TypeScript FirebaseListObservable.push怎么用?TypeScript FirebaseListObservable.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2/database.FirebaseListObservable
的用法示例。
在下文中一共展示了FirebaseListObservable.push方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
handler: data => {
if (isNew) {
this.ListaPlaca.push({ 'placa': data.placa, 'tipo' : data.tipo });
} else {
this.ListaPlaca.update(placa, { placa: data.placa });
}
}
示例2: 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 });
}
}
示例3: 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]);
}
示例4: 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"}
] });
}
示例5: 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!')
}
示例6: 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;
}
}
示例7: 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;
}
}
示例8: createPlaca
public createPlaca(){
this.placaModel = this.placaModel.replace(/-/gi,'')
this.placaModel = this.placaModel.replace(/_/gi,'')
this.ListaPlaca.push({placa:this.placaModel, tipo:this.tipoModel});
this.toastOptions = {
message: "Denuncia da placa " + this.placaModel + " efetuada.",
duration: 3000,
position: 'top',
}
this.toast.create(this.toastOptions).present();
this.placaModel = '';
}
示例9: Error
.then(authRes => {
window.localStorage.setItem('uid', authRes.uid);
this.medicos.push({
email : data.email,
nome : data.nome,
crm : data.crm,
especialidade : data.especialidade.toUpperCase(),
estado : data.estado.toUpperCase(),
cidade : data.cidade.toUpperCase(),
bairro : data.bairro,
logradouro : data.logradouro,
uid : authRes.uid
}).then(res => {
return firebase.Promise.resolve();
}, error => {
// TODO Rollback na criação do usuário de autenticação
console.error("cadastro de usuário - ", error);
return firebase.Promise.reject(new Error("falha ao cadastrar médico na base"));
});
}, error => {
示例10: addDrink
addDrink(drinker: Drinker, drank: number): void {
this.drinks.push({drinkerKey: drinker.$key, amount: drank, time: moment.utc().toJSON()});
}