【发布时间】:2016-07-12 11:32:27
【问题描述】:
问题:
单击“立即发布”后仍会显示已填写表格的模式,如果再次单击“立即发布”,它会一次又一次地添加相同的数据。
我想在填写完所有表单并单击按钮后,刷新页面并转到带有预测描述的链接。
Prediction.createPrediction($scope.prediction).then(function(ref) {
$toaster.pop('success', 'Prediction posted successfully.');
$scope.prediction = {
player1: '',
player2: '',
winner: '',
venue: '',
date: '',
round: '',
description: '',
odd: '',
score: '',
status: 'open',
gravatar: '',
name: '',
poster: ''
};
$location.path('/browse/' + ref.key());
});
应用链接:https://sportpredictions.firebaseapp.com/#/ (发布预测仅适用于登录用户)
GitHub 上的源代码:https://github.com/NiR-IT/tennispredictions(scripts/services/prediction.js、scripts/controllers/prediction.js、views/partials/post.html)。
【问题讨论】:
-
我们是否假设这不起作用?发生了什么?
-
在模态中单击按钮提交后页面不刷新。因此,如果手动关闭模态并再次单击“发布预测”按钮,则会出现相同的模态,已填写表单。
标签: javascript jquery angularjs firebase