我在控制器中使用httppost动作并使用角度js进行调用。但是第二个参数的getiing始终为null。
android:layout_width="wrap_content"
我的角度js控制器是
[HttpPost]
public JsonResult Services_PageSize(string PageSize, string ServiceCategory_Id)
{
int n;
bool isNumericPageSize = int.TryParse(PageSize, out n);
bool isNumericServiceCategory_Id = int.TryParse(ServiceCategory_Id, out n);
return new JsonResult { Data = new { Services = _Services, Status = isNumericPageSize }, };
}
答案 0 :(得分:0)
您的第二个参数应该是ServiceCategory_Id
而不是ServiceCategoryId
(参数名称中遗漏了_
)。
this.getServices = function (pageSize, ServiceCategoryId) {
return $http({
method: "post",
url: "/Home/Services_PageSize?pageSize=" + pageSize + "& ServiceCategory_Id=" + ServiceCategoryId
});
}
更好的选择是应该从post
this.getServices = function (pageSize, ServiceCategoryId) {
return $http({
method: "post",
url: "/Home/Services_PageSize",
data: {
PageSize: pageSize,
ServiceCategory_Id: ServiceCategoryId
}
});
}