I'm facing a small issue.
I am trying to set up an ng-click event that redirects, but before the redirect happens, I need to send some data through post request.
Here is my HTML code :
<a href="/test" ng-click="updateData($event)">Go</a>
This is my angular updateData function :
$scope.updateData = function($event){
$event.preventDefault();
$http.post(someAddress, $scope.data)
.success(function(){
// on success redirect
});
};
I came across something like this scope.$eval(clickAction);
but I'm not sure how to implement it in my case.
I need to use JS for the redirect as I have 2 different forms that require separate handling.