Почему у меня в консоли выводит undefined?
<form id="newrecord" ng-submit="newrecord()">
<input type="text" class="form-control" ng-model="newData.title" placeholder="Название"><br>
<textarea class="form-control" rows="7" ng-model="newData.text" placeholder="Текст"></textarea><br>
<!-- <label for="inputFile">Картинка: </label>
<input type="file" id="inputFile" ng-model="newData.image"><br> -->
<button class="btn btn-primary">Добавить</button>
</form>
.controller('adminCtrl', function( $scope, $http ){
$scope.collection = [];
$scope.newData = [];
$scope.newrecord = function() {
$scope.collection.push($scope.newData);
$http({
url: '/newrecord',
method: "POST",
data: $.param($scope.collection),
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}).success(function(data){
console.log(data);
})
}
})