I wanted to ask what I am doing wrong, method : 'POST' I get $scope.data.push(...) is not a function but the data specified in the "POST" data{...} parameters are fasting as it should, but server issues 201.
Here is my template -
<div class="container create"> <div class="heading"> <h1>Creat invoice</h1> </div> <div class="wrapper form-container"> <form> <div class="row"> <div class="col-6"> <div class="form-group"> <label for="formNumber">Number:</label> <input ng-model="invoice.number" type="text" class="form-control" id="formNumber" placeholder="Enter number"> </div> <div class="form-group"> <label for="formSupplyDate">Supplay Date: </label> <input ng-model="invoice.date_supply" type="text" class="form-control" id="formSupplayDate" placeholder="Select date"> </div> </div> <div class="col-6"> <div class="form-group"> <label for="formDate">Invoice Date: </label> <input ng-model="invoice.date_due" type="text" name="Date" id="formDate" class="form-control" placeholder="Select date"> </div> </div> </div> <div class="form-group"> <label for="formComment">Comment: </label> <textarea ng-model="invoice.comment" name="Comment" id="formComment" cols="50" rows="3" placeholder="Write..." class="form-control"></textarea> </div> </form> </div> <div class="button-save d-flex justify-content-end"> <input type="button" class="btn btn-primary" ng-click="addNewInvoice(invoice)" value="Save"> </div> </div> Here is my component -
angular.module('addInvoices').component('addInvoices', { templateUrl: 'add-invoices/add-invoices.template.html', controller: ['$routeParams', '$http', '$scope', function AddInvoicesController($routeParams, $http, $scope) { console.log('HELLOOO!'); this.addInvoices = $routeParams.addInvoices; $scope.addNewInvoice = function(invoice) { $scope.date = new Date(); console.log('HI MAN'); $http({ method : 'POST', url : 'http://localhost:3000/invoices', data : { 'number' : invoice.number, 'comment' : invoice.comment, 'date_supply' : invoice.date_supply, 'date_created' : $scope.date, 'date_due' : invoice.date_due } }).then(function(response){ $scope.data = response.data; console.log(response); $scope.data.push(invoice.comment, invoice.number, invoice.date_supply, invoice.date_due, invoice.date_created); }, function(response){ }); }; } ] }); The console displays the following console.log(response.data); after clicking with the entered data, all input gives $scope.data.push is not a function 

$ctrlis indicated on the click - Pavel Igorevichangular.js:14961 TypeError: Cannot read property 'push' of undefined- Pavel Igorevichconsole.log($scope.data.push);- I get the following -{id: "7uaCr7J"}- not quite as it were, what I need - Pavel Igorevich