成功将记录推送到 Firebase,但 Google Chrome 在推送数据时挂起
Successfully push the record into Firebase, but Google Chrome hangs while pushing the data
这是我的应用程序的控制器文件。它完美地添加了数据,但是当它到达 then 关键字时 google chrome 挂起但关键参数也被添加到数据库中。我不知道问题出在哪里。
.controller('recordsCtrl', ['$scope','$firebaseArray',function($scope,$firebaseArray) {
$scope.records = $firebaseArray(rootRef);
//show form
$scope.showAddForm = function(){
$scope.addFormShow = true;
}
// hide form
$scope.hide = function(){
$scope.addFormShow = false;
}
// submit contact
$scope.addFormSubmit = function() {
console.log("adding form...")
// Assign values
if ($scope.lname) { var lname = $scope.lname; } else { var lname = null; }
if ($scope.mname) { var mname = $scope.mname; } else { var mname = null; }
if ($scope.fname) { var fname = $scope.fname; } else { var fname = null; }
if ($scope.email) { var email = $scope.email; } else { var email = null; } if ($scope.conId) { var conId = $scope.conId; } else { var conId = null;}
// Build Object
$scope.records.$add({
fname: fname,
lname: lname,
mname: mname,
email: email,
company: company,
conId: conId
}).then(function(rootRef) {
***//this is not printed in the console but the key is assigned to the database***
console.log("Assign root key");
var id = rootRef.key();
console.log("Added Record with ID: " + id);
// clear Form
clearFields();
// Hide Form
$scope.addFormShow = false;
// send message to use
$scope.msg = "Record Added";
});
}
}]);
我的团队 运行 在我们更新到 Firebase 3 时遇到了这个问题。7.x。我相信这是一个已知的错误。
尝试降级到 Firebase 3。6.x。
这是我的应用程序的控制器文件。它完美地添加了数据,但是当它到达 then 关键字时 google chrome 挂起但关键参数也被添加到数据库中。我不知道问题出在哪里。
.controller('recordsCtrl', ['$scope','$firebaseArray',function($scope,$firebaseArray) {
$scope.records = $firebaseArray(rootRef);
//show form
$scope.showAddForm = function(){
$scope.addFormShow = true;
}
// hide form
$scope.hide = function(){
$scope.addFormShow = false;
}
// submit contact
$scope.addFormSubmit = function() {
console.log("adding form...")
// Assign values
if ($scope.lname) { var lname = $scope.lname; } else { var lname = null; }
if ($scope.mname) { var mname = $scope.mname; } else { var mname = null; }
if ($scope.fname) { var fname = $scope.fname; } else { var fname = null; }
if ($scope.email) { var email = $scope.email; } else { var email = null; } if ($scope.conId) { var conId = $scope.conId; } else { var conId = null;}
// Build Object
$scope.records.$add({
fname: fname,
lname: lname,
mname: mname,
email: email,
company: company,
conId: conId
}).then(function(rootRef) {
***//this is not printed in the console but the key is assigned to the database***
console.log("Assign root key");
var id = rootRef.key();
console.log("Added Record with ID: " + id);
// clear Form
clearFields();
// Hide Form
$scope.addFormShow = false;
// send message to use
$scope.msg = "Record Added";
});
}
}]);
我的团队 运行 在我们更新到 Firebase 3 时遇到了这个问题。7.x。我相信这是一个已知的错误。
尝试降级到 Firebase 3。6.x。