Thursday, November 13, 2014
How to pass paramters in Angular for http$.get and http$.post?
For http$.get
$scope.ButtonClickEventGet = function () {
$http.get(
'ControllerName/Action',
{ params: { postcode: $scope.PostalCode } }
).success(
function (data, status, headers, config) {
$scope.Result = data;
}
);
};
For http$.post (Don't know why it is different with get method)
$scope.ButtonClickEventPost = function () {
$http.post('ControllerName/ActionName', { postcode: $scope.models.PostalCode }).success(
function (data, status, headers, config) {
$scope.Result = data;
}
);
};
Subscribe to:
Posts (Atom)