There is an array of questions that are displayed on the form. I want to get all the answers into an array that I can push to Firebase.
This question (Angularjs equivalent to serialize) is pretty similar. However, I do not have ids per question and that answer does not provide the controller code.
Here is the HTML:
<form ng-submit="addAnswers()">
<dd ng-repeat="questions in itemform.questions">
{{questions}}
<input type="text" ng-model = "answers">
</dd>
<input type="submit">
</form>
Here is the controller:
phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$firebaseObject',function($scope, $firebaseObject) {
$scope.addAnswers = function() {
var ans = new Firebase("https://APP.firebaseio.com/answers");
var x = $scope.answers;
console.log($element.serialize()); //says "element is not defined"
console.log(x.serializeArray()); "says x is undefined
};
}]);