我试图将对象从AngularJS 1.x传递给控制器,我的角度代码就像
var searchCriteria =
{
from: vm.From,
to: vm.To,
region: vm.SelectedRegion,
city: vm.SelectedCity,
buildingType: vm.selectedBuildType,
buildingid: vm.selectedHospitalID,
leaderId: vm.SelectedTeamLeader,
teamid: vm.SelectedTeam,
userId: vm.SelectedEvaluator,
trainerId: vm.SelectedTrainer,
status: vm.selectVisitStatus,
}
将上述对象传递给控制器的代码,
var controllerUrl = utilitiesService.getFullPath() + '/Survey/establishmentAllRecord/' + { searchCriteria: searchCriteria };
在控制器端,我正在使用此代码,
public FileResult establishmentAllRecord(object searchCriteria)
{
}
在object searchCreiteria
中的此控制器上,它显示所有值都为null ??
有什么建议吗?
答案 0 :(得分:0)
您通过$http
服务来发出POST请求:
.controller('ctrl', ['$http', function($http){
//your code...
$http({
url: utilitiesService.getFullPath() + '/Survey/establishmentAllRecord',
method: "POST",
data: searchCriteria
});
}])
[HttpPost]
public FileResult establishmentAllRecord(SearchCriteria searchCriteria)
{
}