2016-05-08 33 views
1

我无法将表单提交到firebase。我试着玩弄不同的事件监听器和调用函数的方法,但不能将数据传到firebase。以下是我currnetly有简单的表格提交角&Firebase

var firebaseRef = new Firebase("https://site.firebaseio.com/things"); 
var postRef = firebaseRef.push(); 

$scope.submitPost = function(){ 
    firebaseRef.push = ({Title: $scope.title, Description: $scope.moreinfo, Email: $scope.email, Number: $scope.number, Date: $scope.rtime}); 
    console.log('dome'); 
}; 

HTML

//divs all look like this for different inputs 

<div class="form-group"> 
    <label for="phone">Phone Number</label> 
    <input id="phone" ng-model="phone" 
    type="text> 
</div> 

提交

+0

你在做什么是没有棱角。此外,完全关闭jQuery设计可能是它不工作的原因。尝试使用ngModel和ngClick正确地做到这一点。如果你关心你的应用,请删除jQuery。 – dfsq

+0

角码在哪里?这不是一个有棱角的形式。 –

+0

@MohaiminMoin,我更新了它,让我知道你在想什么!感谢' –

回答

0

push与签名功能:

push() - push([value], [onComplete]) 
Generates a new child location using a unique key and returns a Firebase reference to it. 

在这里看到的文档。 https://www.firebase.com/docs/web/api/firebase/push.html

使用示例

var messageListRef = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list'); 
    messageListRef.push({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' }); 
// Same effect as the previous example, but we've combined the push() and the set().