简单的表单提交角度&火力地堡

时间:2016-05-08 07:23:38

标签: javascript angularjs firebase firebase-realtime-database

我无法向Firebase提交表单。我试过玩不同的事件监听器和调用函数的方法,但不能将数据传递给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>

提交

1 个答案:

答案 0 :(得分: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().