2016-05-08 34 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().