【发布时间】:2019-02-24 09:05:20
【问题描述】:
这是我的代码。 实际上,我正在使用 firebase 服务器在 ionicframework 上开发应用程序。 这是我的提供程序文件(firebase.js)
commentPost(key, comment) {
return new Promise((resolve, reject) => {
this.dataProvider.getComments(key).take(1).subscribe((comments) => {
var comments = comments;
if (!comments) {
comments = [comment];
} else {
comments.push(comment);
}
// Add both users as friends.
this.dataProvider.postComments(key).update(comments).then((success) => {
resolve(true)
}).catch((error) => {
this.loadingProvider.hide();
reject(false)
});
});
})
}
【问题讨论】:
-
{}表示它是一个对象。push可用于数组
标签: typescript firebase ionic-framework ionic3 typescript2.0