I need to save a form to the bank, with several input fields. Someone has an example of how you would pass the fields. I am using the framework AngularJS (If you need to transform them into an array or use json encode).
This is the part of the view that contains the form. Doubt is like sending preco1
and nome1
to the bank. The file with the parameters and the configuration is Ok
<script>
angular.module("slimApp", []);
angular.module("slimApp").controller("slimAppController", function($scope, $http){
$scope.app = "Slim Produtos";
$scope.adicionarProduto = function(produtos){
$http.post('http://localhost/SlimProjeto/RestProdutos/produtos', {nome1:'', preco1:''}).
success(function(data, status, headers, config) {
}).
error(function(data, status, headers, config) {
});
};
});
</script>
</head>
<body ng-controller="slimAppController">
<div class="jumbotron">
<h3>{{app}}</h3>
<form class="form-control" method="post" id="form">
<input type="text" id="nome1" name="nome1"/>
<input type="text" id="preco1" name="preco1"/>
<button class="btn btn-block btn-primary" ng-click="adicionarProduto(form)" >Adicionar Produto</button>
</form>
</div>