0
I need to do a POST after a button click, so that this POST activates a method in a MVC controller, was testing as follows:
[HttpPost]
public void GerarPDF()
{
string teste = "teste";
}
The name of the Controller is Itemcontroller, already on the button I put the ng-click with the angle function:
<button type="submit" ng-click="exibiritem()" class="navbar-btn btn btn-modal" style="margin-right:0px;" id="btnExibir">
<center>Exibir</center>
</button>
And in the angular controller:
function exibiritem(){
$http({
url: "/item/GerarPDF",
method: "POST"
)};
}
I’m just not getting the function in the MVC controller executed. If anyone can help me, I would be very grateful, because my knowledge in angular is still very basic.
Starting from the beginning, the function
exibirItem()
is being called at the click of the button?– Jéf Bueno
this ng-click="display()"
– Brayan
Maybe it’ll help. Post example: http://stackoverflow.com/questions/32026618/angular-http-post-with-asp-net-mvc Get example: http://stackoverflow.com/questions/37844205/read-the-returned-json-datafrom-mvc-controller-angular-controller
– Anderson Machado