该功能可以工作并将用户输入提交给我的firebase"后端"但是在使用ng-submit之后我无法弄清楚清空输入字段的明确功能。输入与var" emailInput"相关联。与ng模型。谢谢你的任何建议!
var newEmailref = new Firebase("https://nevermind.com");
$scope.email = $firebaseArray(newEmailref);
$scope.addEmail = function(email) {
$scope.email.$add(email);
$scope.emailInput = '';
};
答案 0 :(得分:0)
我需要为电子邮件输入分配一个键,也需要一个空对象。
$scope.emailInput = {};
var newEmailref = new Firebase("https://archerthedog.firebaseio.com/email");
$scope.email = $firebaseArray(newEmailref);
$scope.addEmail = function(email) {
$scope.email.$add(email);
$scope.emailInput = {};
};
答案 1 :(得分:0)
您的代码只需稍加修改即可使用$scope.email = "";
代替$scope.emailInput = '';
:
var newEmailref = new Firebase("https://nevermind.com");
$scope.email = $firebaseArray(newEmailref);
$scope.addEmail = function(email) {
$scope.email.$add(email);
$scope.email = '';
};
答案 2 :(得分:0)
我没有得到你....如果在firebase数据库中添加一个项目,数据库将创建键值, 如果你这样做
@Override
protected void onPostExecute() {
Intent intent = new Intent(login.this, MainActivity.class);
intent.putExtra("driver_obj" , driver); // driver should be declared as global in `UserLoginTask` class.
activity.startActivity(intent);
overridePendingTransition(R.anim.right_in, R.anim.left_out);
finish();
}
对于takeData.key,console.log的回答是一些id值 (-Ko7cGuymlshrS2JQEEC) 然后,takenData.val()。email)是一个电子邮件地址......
答案 3 :(得分:0)
See the Full code of mine it's working for me
var ref = firebase.database().ref();
var firebasedata = $firebaseObject(ref);
var messagesRef = ref.child("storeUserData");
var data = $firebaseArray(messagesRef)
$scope.createItem= function(user) {
data.$add(user).then(function(data) {
$scope.user = "";
var myPopup = $ionicPopup.show({
title: 'Dear User, Your Account has created Successfully',
});
$timeout(function() {
myPopup.close(); //close the popup after 6 seconds for some reason
}, 6000);
});
}
ref.orderByValue().on("value", function(data) {
data.forEach(function(takenData) {
console.log("The " + takenData.key + " rating is " +
takenData.val().email);
});
});