This is my angular controller that performs the post function
app.controller ('accountsCtrl', function($scope, $http) {
this.accounts = { code:"", account_name:"", description:"", account_type_id:"", is_active:"", user_id:"", owner_id:""};
$scope.addPage = "#!/account";
$scope.uploadPage = "upload.html";
$scope.exportPage = "export.html";
let user_token = local_store("get", "primalfitsUser").token;
let headers = {
"Content-Type":'application/x-www-form-urlencoded;charset=utf-8;',
"Authorization":"Bearer "+user_token
};
$scope.account_save = function($http) {
this.accounts.is_active = 1;
console.log(this.accounts);
// $http.post(base_api_url+"/accounts",$httpParamSerializerJQLike(this.accounts) ,{"headers":headers}).then(
// result => console.log(result)
// ).catch(error => console.log(error));
$http({
url: base_api_url+"/accounts",
method: "POST",
headers: headers,
data: {'message' : this.accounts},
paramSerializer: '$httpParamSerializerJQLike'
}).then((result) =>{
$scope.info = result.data.message;
}, function(error){
$scope.error = error;
});
};