Good day. I try to perform a POST request, but the data of the post parameter does not seem to go away, because sending a POST through a normal html form returns the correct answer. Where could I make a mistake?
app = angular.module('testApp', []); app.controller('TestCntr', ['$scope', '$http', function($scope, $http) { $scope.items = []; $http({ method: 'POST', url: 'http://portal.com/comp/api/', data: {md2: "74c32512c6c700672652fbcc7db70d18"} }) .then(function(response) { console.log(response.data); $scope.items = response.data; }); }]);
ngRouteusedngRoutethen theresolvemethod can be used, in this case, the filled objects item can be passed to the controller, by the way, and why you are not using the shortened version , i.e.$http.post(url, data).then()? - Baldthenwrite.catch(function(err){console.log(err)}). - Stepan Kasyanenko